Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to source-map 0.6.1 causes an error when running Webpack #28

Closed
wvankuipers opened this issue Nov 4, 2017 · 30 comments
Closed

Comments

@wvankuipers
Copy link

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.

@joshwiens
Copy link
Member

@wvankuipers - I've tried v1.0.2 in quite a few spots without being able to repo this.

Issues with source-map@0.6.x are pretty wide spread from what I have read thus far, meteor among others.

There is no changelog for either of the 0.6.x releases & quite a few commits to sift through. I can't repo with anything I have access to, either getting a look at what you are having trouble with or anything minimal where this can be repro'd would be extremely helpful.

@wvankuipers
Copy link
Author

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.

@wvankuipers
Copy link
Author

I did some more research and it seems to be coming down to this line in the Backbone.Marionette library:

typeof define === 'function' && define.amd ? define(['backbone', 'underscore', 'backbone.radio'], factory) :

And then specificly

define(['backbone', 'underscore', 'backbone.radio'], factory)

Even removing the rest of that file's content and leaving only this part there will cause Webpack to fail with the error above... Removing this line and Webpack wil succeed.

@wvankuipers
Copy link
Author

A (temporary) workaround for this issue is to add

sourceMap: null

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

@dancollingridge
Copy link

dancollingridge commented Nov 6, 2017

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",

@michael-ciniawsky
Copy link
Member

@dancollingridge Could you provide Error logs and a bit of relevant context about your project ?

@fkarczeski
Copy link

I also had the same issue.

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] (webpack-repo\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:276:15)
at SourceMapGenerator_addMapping [as addMapping] (webpack-repo\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:110:12)
at webpack-repo\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:72:17
at Array.forEach (native)
at SourceMapConsumer_eachMapping [as eachMapping] (webpack-repo\node_modules\webpack-sources\node_modules\source-map\lib\source-map-consumer.js:157:14)
at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (webpack-repo\node_modules\webpack-sources\node_modules\source-map\lib\source-map-generator.js:48:24)
at SourceMapSource.node (webpack-repo\node_modules\webpack-sources\lib\SourceMapSource.js:32:35)
at SourceMapSource.proto.sourceAndMap (webpack-repo\node_modules\webpack-sources\lib\SourceAndMapMixin.js:30:18)
at getTaskForFile (webpack-repo\node_modules\webpack\lib\SourceMapDevToolPlugin.js:33:30)
at chunk.files.forEach.file (webpack-repo\node_modules\webpack\lib\SourceMapDevToolPlugin.js:91:21)
at Array.forEach (native)
at webpack-repo\node_modules\webpack\lib\SourceMapDevToolPlugin.js:89:18
at Array.forEach (native)
at Compilation.<anonymous> (webpack-repo\node_modules\webpack\lib\SourceMapDevToolPlugin.js:88:12)
at Compilation.applyPlugins1 (webpack-repo\node_modules\tapable\lib\Tapable.js:75:14)
at self.applyPluginsAsync.err (webpack-repo\node_modules\webpack\lib\Compilation.js:644:11)
at next (webpack-repo\node_modules\tapable\lib\Tapable.js:202:11)
at Compilation.<anonymous> (webpack-repo\node_modules\babili-webpack-plugin\lib\index.js:106:11)
at next (webpack-repo\node_modules\tapable\lib\Tapable.js:204:14)
at webpack-repo\node_modules\last-call-webpack-plugin\index.js:156:7
at process._tickCallback (internal/process/next_tick.js:109:7)

@michael-ciniawsky
Copy link
Member

@fkarczeski Could you try without the babili-webpack-plugin please ?

@dancollingridge Are you also using babili-webpack-plugin for minification?

@dancollingridge
Copy link

Exact same trace as posted above.

My app is a Vue.js app.

package.json target is:

"build": "node build/build.js",

npm run build produces:

$: npm run build
npm info it worked if it ends with ok
npm info using npm@4.2.0
npm info using node@v7.9.0
npm info lifecycle lift@0.1.0~prebuild: lift@0.1.0
npm info lifecycle lift@0.1.0~build: lift@0.1.0

> lift@0.1.0 build /var/www/lift
> node build/build.js

⠹ building for production.../var/www/lift/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 mea.............

@dancollingridge
Copy link

Yes, I am using babili-webpack-plugin.

@dancollingridge
Copy link

In build/webpack.prod.conf.js:

var BabiliPlugin = require("babili-webpack-plugin")
//.......a bunch of other code.......
new BabiliPlugin({}, {}),
//.......a bunch of other code.......

@michael-ciniawsky
Copy link
Member

@dancollingridge Does the build succeed without babili-webpack-plugin ?

new BabiliPlugin({}*, {}*),

is this* 'pseudo' or did you try without any options ?

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Nov 6, 2017

Which version of babili-webpack-plugin ?

⚠️ It was recently renamed to babel-minify-webpack-plugin which includes a newer version of babel-minify (former babili)

@michael-ciniawsky
Copy link
Member

cc @boopathi

@fkarczeski
Copy link

@michael-ciniawsky , not calling BabiliPlugin works (as expected).

This is my current set up that fails:
new BabiliPlugin({}, require("babel-preset-minify"))

Calling with no options also fails for me with the same error:
new BabiliPlugin({}, {})

babili-webpack-plugin "version": "0.1.2"

@michael-ciniawsky
Copy link
Member

Yep, the plugin uses webpack-sources directly to update the assets

@dancollingridge
Copy link

If I disable babili-webpack-plugin in webpack.config the build works.

If I replace babili-webpack-plugin with babel-minify-webpack-plugin I get the same error as before.

@wvankuipers
Copy link
Author

I also tried both babili-weback plugin and babel-minify-webpack-plugin and found them both giving the same error. As proposed by @mattdsteele I created a issue in the source-map project as this seems not to be purely related to the webpack-sources package.

@breadadams
Copy link

I'm using babel-minify-webpack-plugin@0.2.0, forcing webpack-sources to 1.0.1 in package.json as @dancollingridge suggested appears to fix it for now (as many more have said here webpack/webpack#5931)

@jussikinnula
Copy link

I'm also interested in this.

@nealoke
Copy link

nealoke commented Dec 16, 2017

Just wanted to chip in and say that in my case it doesn't matter if i use the BabiliPlugin() or not, as long as I don't have the "webpack-sources": "1.0.1" installed it always fails.

Also wanted to provide you with my files used:

Cases

  • npm run server -> no error
  • npm run server:test -> error (if webpack-sources@1.0.1 is not explicitly installed)
  • npm run build:prod -> no error

@catamphetamine
Copy link

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

@alex-kinokon
Copy link

@catamphetamine It works because then you’d be using an entirely different thing.

@anthonator
Copy link

Has anyone tried source-map 0.7.0?

@SEAPUNK
Copy link

SEAPUNK commented Feb 6, 2018

So is the solution here to just not use the babili plugin, or is there a version we can bump to get rid of this error?

@scottohara
Copy link

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 (mozilla/source-map#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.

@SEAPUNK
Copy link

SEAPUNK commented Feb 6, 2018

@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.

swernerx added a commit to sebastian-software/edge that referenced this issue Feb 15, 2018
… Uglify now, we can use the same for both server+client. See: webpack/webpack-sources#28
gluxon added a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Feb 19, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
gluxon added a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Feb 19, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
gluxon added a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Feb 19, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
gluxon added a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Feb 19, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
gluxon added a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Feb 19, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
Nexuist pushed a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Feb 21, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
jgraichen added a commit to mnemosyne-mon/mnemosyne-server that referenced this issue Feb 27, 2018
Disable source-map for production as babel-minify-webpack-plugin
fails otherwise.
@thuringia
Copy link

thuringia commented Mar 8, 2018

@anthonator source-map@7does not work at least in my limited testing. It's trowing a TypeError now in webpack's source-map devtool

TypeError: aSourceMapConsumer.eachMapping is not a function
[0] at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (/Users/rwa/Developer/hotel/node_modules/source-map/lib/source-node.js:86:24)
[0] at SourceMapSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/SourceMapSource.js:39:21)
[0] at ReplaceSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ReplaceSource.js:70:30)
[0] at CachedSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/CachedSource.js:18:24)
[0] at /Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:37:50
[0] at Array.map ()
[0] at ConcatSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:36:63)
[0] at /Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:37:50
[0] at Array.map ()
[0] at ConcatSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:36:63)
[0] at /Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:37:50
[0] at Array.map ()
[0] at ConcatSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:36:63)
[0] at /Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:37:50
[0] at Array.map ()
[0] at ConcatSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:36:63)
[0] at /Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:37:50
[0] at Array.map ()
[0] at ConcatSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:36:63)
[0] at /Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:37:50
[0] at Array.map ()
[0] at ConcatSource.node (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/ConcatSource.js:36:63)
[0] at ConcatSource.proto.sourceAndMap (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
[0] at CachedSource.sourceAndMap (/Users/rwa/Developer/hotel/node_modules/webpack-sources/lib/CachedSource.js:56:31)
[0] at getTaskForFile (/Users/rwa/Developer/hotel/node_modules/webpack/lib/SourceMapDevToolPlugin.js:34:30)
[0] at files.forEach (/Users/rwa/Developer/hotel/node_modules/webpack/lib/SourceMapDevToolPlugin.js:127:20)
[0] at Array.forEach ()
[0] at compilation.hooks.afterOptimizeChunkAssets.tap (/Users/rwa/Developer/hotel/node_modules/webpack/lib/SourceMapDevToolPlugin.js:121:12)
[0] at SyncHook.eval (eval at create (/Users/rwa/Developer/hotel/node_modules/tapable/lib/HookCodeFactory.js:17:12), :7:1)
[0] at SyncHook.lazyCompileHook [as _call] (/Users/rwa/Developer/hotel/node_modules/tapable/lib/Hook.js:35:21)

ebiiii added a commit to SwissDataScienceCenter/renku-ui that referenced this issue Mar 23, 2018
ableuler pushed a commit to SwissDataScienceCenter/renku-ui that referenced this issue Mar 25, 2018
RubenVerborgh added a commit to linkeddata/rdflib.js that referenced this issue Apr 10, 2018
@wvankuipers
Copy link
Author

Seems to be an issue with webpack-contrib/babel-minify-webpack-plugin#68 but not sure if it is originated in this project or babel-minify

gluxon added a commit to SquaredLabs/squaredlabs.uconn.edu that referenced this issue Jul 6, 2018
The babel-minify-webpack-plugin was giving me a strange error when
building. The Webpack builtin production minifier f does not seem have
this issue.

webpack/webpack-sources#28
@alexander-akait
Copy link
Member

We use latest source-map version with compatibility node@6 (https://github.com/webpack/webpack-sources/blob/master/package.json#L19), will be updated after we drop support node@6, plugins can use own version, feel free create issue where we use old version

tusharchitti added a commit to tusharchitti/nuclear that referenced this issue Jul 4, 2019
nukeop pushed a commit to nukeop/nuclear that referenced this issue Jul 5, 2019
* made changes for travis to run buil on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* changes in package.json

* changes in package.json

* changes in package.json

* Applying a workaround using
electron-userland/electron-webpack-quick-start#14

* Changing webpack version to 4.x, with reference to
webpack/webpack-sources#28
nukeop pushed a commit to nukeop/nuclear that referenced this issue Sep 30, 2019
* made changes for travis to run buil on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* made changes for travis to run build on windows

* changes in package.json

* changes in package.json

* changes in package.json

* Applying a workaround using
electron-userland/electron-webpack-quick-start#14

* Changing webpack version to 4.x, with reference to
webpack/webpack-sources#28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests