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

With webpack 5 and source-map-loader, source map parsing fails #19

Open
fwextensions opened this issue Nov 20, 2021 · 1 comment
Open

Comments

@fwextensions
Copy link

fwextensions commented Nov 20, 2021

Describe the bug
When using source-map-loader in webpack 5 to include source maps from node modules, I'm getting this warning when building my code:

WARNING in ./node_modules/@watergis/mapbox-gl-legend/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\ ... \node_modules\@watergis\mapbox-gl-legend\lib\index.ts' file:
Error: ENOENT: no such file or directory, open 'C:\ ... \node_modules\\@watergis\mapbox-gl-legend\lib\index.ts'

I'm not sure why it's looking for index.ts when loading the source maps, but I think I didn't see this with webpack 4, and haven't seen issues with other modules.

To Reproduce
The webpack.config.js file for this project includes this rule:

    module: {
      rules: [
       {
          test: /\.js$/,
          enforce: 'pre',
          use: ['source-map-loader'],
        }

It's including source-map-loader v3.0.0.

Expected behavior
The source map should be included in dev builds, as it is with other npm modules.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 95
@fwextensions
Copy link
Author

With v1.2.1 of the legend module, I also see this warning:

WARNING in ./node_modules/@watergis/mapbox-gl-legend/dist/legend-control.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\ ... \node_modules@watergis\mapbox-gl-legend\lib\legend-control.
ts' file: Error: ENOENT: no such file or directory, open 'C:\ ... \node_modules@watergis\mapbox-gl-legend\lib\legend-control.ts'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant