webpack-sources: Update to source-map 0.6.1 causes an error when running Webpack

This update seems to create another issue (this is also reported here):

frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276
        throw new Error(
        ^

Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
    at SourceMapGenerator_validateMapping [as _validateMapping] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12)
    at frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:72:17
    at Array.forEach (<anonymous>)
    at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:48:24)
    at SourceMapSource.node (frontend/node_modules/webpack-sources/lib/SourceMapSource.js:32:35)
    at SourceMapSource.proto.sourceAndMap (frontend/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
    at getTaskForFile (frontend/node_modules/webpack/lib/SourceMapDevToolPlugin.js:33:30)
    at chunk.files.forEach.file (frontend/node_modules/webpack/lib/SourceMapDevToolPlugin.js:91:21)

Reverting to v1.0.1 resolves this issue.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 28
  • Comments: 30 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Same issue here. I had to force install version 1.0.1 (rather than letting webpack pull in its own version) to get my project to build:

     "webpack": "^2.2.1",
+    "webpack-sources": "1.0.1",
     "webpack-bundle-analyzer": "^2.2.1",
     "webpack-dev-middleware": "^1.10.0",
     "webpack-hot-middleware": "^2.16.1",

Replacing require('babili-weback-plugin') with require('uglifyjs-webpack-plugin') works

If you can wait a couple of weeks and assuming you will be able to upgrade immediately; webpack@4.x will come with support for UglifyJS2 (expected on or around Feb 24).

I have a number of projects using babel-minify-webpack-plugin that have been affected by this issue since it first started on 4 November (when webpack-sources@1.0.2 was released), and I’ve been patiently waiting for a fix now for three months. Another couple of weeks (for me) isn’t going to hurt. The only reason I was using babel-minify was for it’s support for >ES5, and since UglifyJS2 will now have this, there’s little reason for me to stick with the former.

It seems like nobody really wants to take ownership of the problem.

Despite numerous examples showing how to reproduce the problem, some of the early comments in the issue over in mozilla/source-map (https://github.com/mozilla/source-map/issues/304) seem to suggest that they think their library is working as intended, and that any ‘fix’ belongs elsewhere.

In webpack/webpack-sources (here), the problem clearly started when moving to source-map@0.6.0; and comments in this thread suggest that they believe the problem squarely lies with source-map.

@scottohara To be honest, I’m not really interested in UglifyJS2; I chose babel-minify, and I want to stick with it. Switching back to UJS2 won’t solve this issue.

In the meantime, the workaround I implemented was forcing webpack to switch to webpack-sources@1.0.1.

I created a simple example here https://github.com/wvankuipers/webpack-test

It seems to be specific to Backbone.Marionette in combination with the babel-minify-webpack-plugin package.

A (temporary) workaround for this issue is to add

sourceMap: null

To the configuration of the babel-minify-webpack-plugin package.