Error in array-set when producing source maps. #76

thlorenz opened this Issue Aug 25, 2013 · 9 comments


None yet
3 participants

I created a repo to reproduce the issue here, but here is the stack trace, it basically breaks in ./lib/array-set.js.

    throw new Error('No element indexed by ' + aIdx);
Error: No element indexed by 1
    at ArraySet_at [as at] (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/array-set.js:83:11)
    at SourceMapConsumer_parseMappings [as _parseMappings] (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/source-map-consumer.js:158:44)
    at new SourceMapConsumer (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/source-map-consumer.js:100:10)
    at module.exports (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/lib/mappings-from-map.js:10:18)
    at Combiner._addExistingMap (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/index.js:28:18)
    at Combiner.addFile (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/index.js:58:12)
    at Stream.write (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/index.js:42:23)
    at (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/through/index.js:26:11)
    at Stream.ondata (stream.js:51:26)
    at Stream.EventEmitter.emit (events.js:95:17)

fitzgen commented Aug 25, 2013

The source map we are trying to parse only has one source listed, but there is a mapping that refers to a second source (at index 1, presumably supposed to be bar.js). This is a bad source map. Looking into which library generates the bad source map (using this lib perhaps?).

{ version: 3,
  file: '/Users/fitzgen/src/repro-sourcemap-issue/foo.js.es6',
  sources: [ '/Users/fitzgen/src/repro-sourcemap-issue/foo.js' ],
  names: [],
  sourcesContent: [ 'class Hello {\n    greet() {\n        return "me";\n    }\n}\nmodule.exports = Hello;\n' ] }

Oh so maybe the combined-source-map module is using source-map generator incorrectly. This may be related to the latest change to that module.

@ben-ng do you have an idea what could be going wrong here?


fitzgen commented Aug 25, 2013

Aside: the combine-source-map module can get a lot smaller and dumber once we make progress with issue(s) 16/69

@thlorenz thlorenz referenced this issue in thlorenz/combine-source-map Aug 27, 2013


Switch to source-map package #6

@fitzgen Yeah those pieces in the works look interesting. combine-source-map will most likely just have to be a rather simple wrapper at that point.

I rolled back the change that caused the problem for now and am waiting for feedback from the author of that PR to see how to proceed. How long do you think until those mentioned changes land? Possibly we should wait with the combine-source-map migration to use this module until then?

@thlorenz thlorenz closed this Aug 27, 2013


fitzgen commented Aug 27, 2013

@thlorenz It is fairly low priority on my TODO list; I'm spending 99% of my hack time on new features for firefox's debugger. If you want to take a crack at it, I will provide speedy review of pull requests :) We did end up deciding on an API in issue 16.

I am flying back to SF from Paris on Saturday, maybe I can take a crack at it then.

Somewhat swamped myself here, but for me personally this is not such high priority either. As far as I understand the original change was attempted to fix problems with source-maps of minified code that @ben-ng ran into.
If this is more important for his module I'll leave this up to him ;)

ben-ng commented Aug 27, 2013

I've been on a road trip through the midwest, finally got back on the internet today.

Yes, this change is very important for my module so i'll fix this one. Thanks for helping with the repro case @thlorenz.

@ben-ng nice!

ben-ng commented Sep 17, 2013

Okay, this issue is definitely in es6ify. I'll take care of it and send a PR now. Thank you for the repro case!

@ben-ng ben-ng referenced this issue in thlorenz/es6ify Sep 17, 2013


es6ify generates invalid sourcemaps #9

MohammadYounes referenced this issue in am11/WebEssentials2013 Sep 23, 2014

srv-rtlcss: Prevent from throwing.
The problem is, when both rtlcss and autoprefixer
are enabled, it works fine with SCSS, but throws
with LESS.

When the code is too complicated,
the `result` object seems to have problem with
returning `result.css` member. When the code is
comparatively straight-forward, it throws a
slightly lenient error.

/cc @MohammadYounes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment