Skip to content

Published JS sourcemaps reference omitted src files #1258

Description

@dmmulroy

Summary

The published memfs tarball includes JavaScript sourcemaps that point at TypeScript sources which are not included in the package, and the maps do not embed sourcesContent. Tools that try to hydrate source content (for example Vite 8) warn when memfs is imported.

I confirmed this in memfs@4.57.1 and the current memfs@4.57.2 tarball.

Example

lib/index.js ends with:

//# sourceMappingURL=index.js.map

lib/index.js.map contains:

{
  "sources": ["../src/index.ts"]
}

but the npm tarball has no src/index.ts, and the map has no sourcesContent array. The other published lib/**/*.js.map entry maps appear to follow the same pattern.

User-visible symptom

With Vite, importing memfs can emit:

Sourcemap for ".../node_modules/memfs/lib/index.js" points to missing source files

With DEBUG=vite:sourcemap, Vite shows the exact missing path:

Missing sources:
  .../node_modules/memfs/src/index.ts

Possible fixes

Any of these would resolve it:

  1. Embed sourcesContent in the published .js.map files.
  2. Publish the referenced src/**/*.ts files.
  3. If source maps are not intended to be useful to consumers, omit the emitted source map comments/maps from the tarball.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions