Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The file dist/source-map-resolve.js is missing in the published package #57

Closed
prantlf opened this issue Aug 5, 2024 · 1 comment · Fixed by #65
Closed

The file dist/source-map-resolve.js is missing in the published package #57

prantlf opened this issue Aug 5, 2024 · 1 comment · Fixed by #65
Labels
bug Something isn't working

Comments

@prantlf
Copy link

prantlf commented Aug 5, 2024

Describe the bug

I got this error after upgrading Rollup from 3 to 4 and replacing rollup-plugin-sourcemaps with rollup-plugin-sourcemaps2:

> rollup -c --environment NODE_ENV:production

[!] Error: Cannot find module '/.../node_modules/rollup-plugin-sourcemaps2/dist/source-map-resolve' imported from /.../node_modules/rollup-plugin-sourcemaps2/dist/index.js
file:///.../node_modules/rollup-plugin-sourcemaps2/dist/source-map-resolve
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/.../node_modules/rollup-plugin-sourcemaps2/dist/source-map-resolve' imported from /.../node_modules/rollup-plugin-sourcemaps2/dist/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:265:11)
    at moduleResolve (node:internal/modules/esm/resolve:933:10)
    at defaultResolve (node:internal/modules/esm/resolve:1169:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36)

It appears that the file dist/source-map-resolve.js is missing in the published package.

To Reproduce

I got the error in a project, which I can't show publicly, but it should happen in any project, when looking at the content of the NPM package:

❯ npm init -y

❯ npm i -D rollup-plugin-sourcemaps2

❯ ls node_modules/rollup-plugin-sourcemaps2/dist
index.cjs  index.cjs.map  index.js  index.js.map

❯ head -n 4 node_modules/rollup-plugin-sourcemaps2/dist/index.js
import pluginUtils from '@rollup/pluginutils';
import fs from 'fs';
import { promisify } from 'util';
import { resolveSourceMap, resolveSources } from './source-map-resolve';

The last line expected the file source-map-resolve.js in the same directory as index.js. The previous command listing the content of rollup-plugin-sourcemaps2/dist didn't show it.

Expected behavior

Either the file src/source-map-resolve.ts should be transpiled to dist/source-map-resolve.js, or bundled inside dist/index.js.

Environment

  • Package Version: 0.3.0
  • Node.js Version: 20.15.1
  • NPM Version: 10.7.0
  • Operating System: macOS Sonoma 14.5 (23F79)
@prantlf prantlf added the bug Something isn't working label Aug 5, 2024
prantlf added a commit to prantlf/rollup-plugin-sourcemaps2 that referenced this issue Aug 5, 2024
Insert all internal modules to `dist/index.js`.

Attempts fo fix 2wce#57.
@2wce 2wce closed this as completed in #65 Aug 10, 2024
@2wce
Copy link
Owner

2wce commented Aug 10, 2024

thank you for reporting this @prantlf I have pushed a fix in the new version, let me know if this fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants