Skip to content

Incompatibility with rollup sourcemaps #60

@GauBen

Description

@GauBen

Hi!

I'm trying to use esrap in a Rollup plugin's transform hook. It works perfectly for the code, but sourcemaps are not generated. After a quick investigation, it turns out esrap uses loc and range for sourcemaps, while Rollup uses start and end.

import { print } from "esrap";

const plugin = {
  name: "dummy-plugin",

  transform(code, id) {
    // Works perfectly for the code, fails for sourcemaps
    return print(this.parse(code), { sourceMapSource: id, sourceMapContent: code });
  },
};

Is there a way to make esrap and Rollup work together? Especially since you created both tools 👀

Thanks!

Related: Jahia/javascript-modules#271

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions