mapbox-gl-legend
mapbox-gl-legend copied to clipboard
With webpack 5 and source-map-loader, source map parsing fails
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
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'