question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source Map Revision 3 Index Map Not Supported

See original GitHub issue

Hi,

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.

example.zip

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
NoxHarmoniumcommented, Aug 31, 2019

Seems to be working well for me, I’ll open a PR and see what people think of the fix

0reactions
NoxHarmoniumcommented, May 20, 2020

We decided not to use the flatten-source-map package, because it is little used and contains an old version of source-map package.

Good point! I’ve tested it in my project and its working great. Thanks for getting the fix in!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source Map Revision 3 Proposal
Add “sourcesContent” line to support self contained source maps. ... An embedded map does not inherit any values from the containing index map....
Read more >
Source map errors — Firefox Source Docs documentation
You can sometimes encounter problems working with source maps. This page explains the most common problems and how to fix them.
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
Missing original source files​​ This likely means that your source map doesn't contain or link to your original source files. Without your ...
Read more >
Antd source map not supported in React - Stack Overflow
This problem occurred after react-script was upgraded to 5.0.0 solution : - import 'antd/dist/antd.css. replace with :
Read more >
Source Maps - Rollbar Docs
Getting started · 1. Raise descriptive errors from JavaScript · 2. Configure the rollbar.js SDK to support source maps · 3. Upload your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found