Source Map Revision 3 Index Map Not Supported
See original GitHub issueHi,
I have a project that is written in ClojureScript. When it outputs source maps it seems to use a format that is in the Source Map Revision 3 spec but is not supported by source-map-loader
.
It seems like the error is caused because the source map uses the alternate “Index map” form, which does not have the sources
key at the root, it has a sections
key which has an array of maps.
See: https://sourcemaps.info/spec.html#h.535es3xeprgt
The exact error I get when trying to load the source map in through webpack is:
…node_modules/source-map-loader/index.js:74 map.sources = map.sources.map(function(s) { return sourcePrefix + s; }); ^
TypeError: Cannot read property ‘map’ of undefined at processMap (…/node_modules/source-map-loader/index.js:74:30) at …/node_modules/source-map-loader/index.js:59:6 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
It mustn’t be a format that is commonly used or this issue would have come up before (unless I’m misunderstanding something)
I’ve attached a sample of the output file and source map that is causing the issue.
The ClojureScript project that outputs the library/source map is: https://github.com/agiledigital/mule-preview/tree/master/client The webpack project that is consuming the source map is: https://github.com/agiledigital/mule-preview/tree/master/browser-plugin
I haven’t had a look yet at how hard this would be to fix, it might be as simple as iterating over each section, or we might have to pre process the source map with something like https://github.com/mozilla/source-map
Hopefully I’ll have some time to do some digging into the spec soon.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top GitHub Comments
Seems to be working well for me, I’ll open a PR and see what people think of the fix
Good point! I’ve tested it in my project and its working great. Thanks for getting the fix in!