Jsoneditor: Incorrectly exporting sourcemaps

Created on 4 Dec 2019  路  6Comments  路  Source: josdejong/jsoneditor

I am getting a warning from webpack using source-map-loader that it cannot find SourceMap 'uri.all.js.map' in 'jsoneditor/dist'. It looks like jsoneditor is not correctly exporting its source maps.

WARNING in <path to node modules>/node_modules/jsoneditor/dist/jsoneditor.js
Module Warning (from <path to node modules>/node_modules/source-map-loader/index.js):
(Emitted value instead of an instance of Error) Cannot find SourceMap 'uri.all.js.map': Error: Can't resolve './uri.all.js.map' in '<path to node modules>/node_modules/jsoneditor/dist'
 @ <path to node modules>/node_modules/jsoneditor/index.js 1:17-45
 ...
bug help wanted

Most helpful comment

Thanks for reporting and the suggestions Maneet.

A totally different solution would be to simply not offer the non-minified version 馃槂

All 6 comments

Thanks for reporting Benjamin.

Looks like the uri.js library (one of the dependencies) has a source mapping (coming from TypeScript I think): https://github.com/garycourt/uri-js/blob/master/dist/esnext/uri.js#L480

I'm not sure how to solve this, strip source map urls from dependencies or so? Or is Webpack supposed to resolve source maps of dependencies into a new source map? Does anyone have an idea?

Getting a similar warning in Google Chrome dev tools while loading the non-minified bundle:

Screen Shot 2020-04-25 at 2 12 21 PM

The JSONEditor bundled code has this line:

//# sourceMappingURL=uri.all.js.map

Looking at the Gulp file, it seems that only for the minified bundle the source map is provided. So that version (*.min.js) is coming out OK. If a sourcemap is provided for non-minified version too, it might be replaced properly automatically. If you don't want to provide sourcemap for non-minified bundle, then I don't see anything wrong with stripping //# sourceMappingURL=uri.all.js.map as 1 possible solution (disclaimer haven't used Gulp/Webpack much, mostly Rollup).

Thanks for reporting and the suggestions Maneet.

A totally different solution would be to simply not offer the non-minified version 馃槂

This issue should be fixed now in v8.6.7. Can you give it a try @maneetgoyal?

No more Chrome devtool warnings @josdejong 馃憤

馃憤

Was this page helpful?
0 / 5 - 0 ratings