Reputation: 861
If I run this command:
rimraf docs/public/assets && cross-env NODE_ENV=production webpack -p --config webpack.production.config.js"
I get this error:
ERROR in app.bundle.js from UglifyJs
Unexpected token: punc (,) [./node_modules/@fortawesome/pro-light-svg-icons/index.es.js:10344,0][app.bundle.js:12196,10]
but if I remove -p
in webpack command, I wont get the error anymore.
What is -p for? Appreciates if anyone can shed some lights in this behaviour.
Upvotes: 2
Views: 181
Reputation: 861
So after half a day of debugging, I resolved this with the following updates:
in package.json
: "uglifyjs-webpack-plugin": "^1.3.0"
in webpack.config.js
: const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
and under plugins
:
plugins: [
..........
new UglifyJsPlugin({
sourceMap: true,
cache: true,
parallel: true,
uglifyOptions: {
warnings: false,
parse: {},
compress: {},
mangle: true,
output: null
}
}),
]
Updating to webpack4 creates more issues than it fixes so it wasn't an option for me since I have too many dependencies that aren't compatible with webpack4. What I need was just a simple minifier. Hope this helps everyone.
Upvotes: 1