I think this is a more appropriate location to file this issue:
webpack-contrib/extract-text-webpack-plugin#98
I disabled extract text plugin and it still gives an error. Its probably in webpack.
So just re posting this:
I get an error if I turn off source map in
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
, sourceMap: false
})
I’m trying to disable source map since my build takes 5 minutes long. Removing it yields 1 minute 40 seconds.
Here’s part of my stack trace
ERROR in bundle.js from UglifyJs
TypeError: Cannot read property 'sections' of null
at new SourceMapConsumer (/var/www/project/node_modules/webpack/node_modules/webpack-core/node_modules/source-map/lib/source-map/source-map-consumer.js:24:21)
at /var/www/project/node_modules/webpack/lib/optimize/UglifyJsPlugin.js:62:23
at Array.forEach (native)
at Tapable.<anonymous> (/var/www/project/node_modules/webpack/lib/optimize/UglifyJsPlugin.js:44:10)
at Tapable.next (/var/www/project/node_modules/webpack/node_modules/tapable/lib/Tapable.js:69:14)
at Tapable.<anonymous> (/var/www/project/node_modules/webpack/lib/optimize/UglifyJsPlugin.js:136:4)
at Tapable.applyPluginsAsync (/var/www/project/node_modules/webpack/node_modules/tapable/lib/Tapable.js:71:13)
at Tapable.<anonymous> (/var/www/project/node_modules/webpack/lib/Compilation.js:564:9)
at Tapable.next (/var/www/project/node_modules/webpack/node_modules/tapable/lib/Tapable.js:67:11)
at ExtractTextPlugin.<anonymous> (/var/www/project/node_modules/extract-text-webpack-plugin/index.js:303:4)
at Tapable.applyPluginsAsync (/var/www/project/node_modules/webpack/node_modules/tapable/lib/Tapable.js:71:13)
at Tapable.<anonymous> (/var/www/project/node_modules/webpack/lib/Compilation.js:560:8)
at Tapable.next (/var/www/project/node_modules/webpack/node_modules/tapable/lib/Tapable.js:67:11)
at ExtractTextPlugin.<anonymous> (/var/www/project/node_modules/extract-text-webpack-plugin/index.js:279:5)
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:52:16
at done (/var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:248:21)
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:44:16
at /var/www/project/node_modules/extract-text-webpack-plugin/index.js:270:6
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:52:16
at done (/var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:248:21)
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:44:16
at /var/www/project/node_modules/extract-text-webpack-plugin/index.js:267:13
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:187:20
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:239:13
at _arrayEach (/var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:91:13)
at _each (/var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:82:13)
at Object.async.forEachOf.async.eachOf (/var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:238:9)
at Object.async.forEach.async.each (/var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:215:22)
at /var/www/project/node_modules/extract-text-webpack-plugin/index.js:241:11
at /var/www/project/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:187:20
What’s your
devtool
?try to reinstall all dependencies.
@sokra just tried reinstalling dependencies. Still getting the same error on build:
I am getting the same error here when using sourcemap false and –optimize-minimize (if I leave the optimize out it works).
when using
new UglifyJsPlugin
and--opimize-minimize
(or-p
) you are adding the UglifyJsPlugin twice. Omit the CLI option.Thanks so much @sokra, This helped me!
Have similar issue, but i don’t specify
sourceMap: false
. Only when i declare this, build pass.+1
fix by remove
-p
+1
fix by remove -p
Is there a fix coming for this? In my opinion Webpack should be smart enough to omit one or the other f both are present.
With Webpack 4,
mode: 'production'
will automatically add optimizations plugins.If you get the following warning/error message when building with
mode: 'production'
, try fixing by below instruction.do not remove UglifyJsPlugin, just add
sourceMap: true
to its config@damianobarbati, you might pass it as
minimizer
option rather than push it as plugin part.Another way I was able to get rid of this issue was by removing
devtool: 'source-map'
from webpack config.