Skip to content

Invalid sourcemap paths for ESM and CJS bundles #192

Description

@justingrant

The current release (0.4.2 EDIT 0.4.3) emits a sourcemap with invalid file paths, which results in console errors in IDEs like VSCode that prefer file references to inline source references in sourcemaps. I haven't kept up with recent changes in build steps, I believe this is a new problem.

Here's the first few lines of node_modules/@js-temporal/polyfill/dist/index.esm.js.map:

{"version":3,"file":"index.esm.js","sources":["../tsc-out/intrinsicclass.js","../tsc-out/slots.js","../tsc-out/calendar.js","../tsc-out/ecmascript.js","../tsc-out/regex.js","../tsc-out/intl.js","../tsc-out/instant.js","../tsc-out/plaindate.js","../tsc-out/plaindatetime.js","../tsc-out/duration.js","../tsc-out/plainmonthday.js","../tsc-out/now.js","../tsc-out/plaintime.js","../tsc-out/timezone.js","../tsc-out/plainyearmonth.js","../tsc-out/zoneddatetime.js","../tsc-out/legacydate.js","../tsc-out/index.js"]

To fix the problem, we should change ../tsc-out to ../lib. I've run into this problem before, and if my memory is correct there's either a TSC and/or a rollup setting that will allow you to set the correct directory path for the sourcemap. If that's too hard, we could just post-process the output in a build step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions