Reputation: 411
I got a legacy vue.js project with webpack: 4.44.1
When I launching build command
webpack --config webpack.config.prod.js --progress
It's started to the building, and throw an error on 92%
ERROR in assets/js/common.js from UglifyJs RangeError: Maximum call stack size exceeded
How can I fix that error? I saw that guys launch node build with max-callstack parameter, but I don't know is there some similar params on webpack?
My package:
{
"name": "webpack-starter",
"version": "1.0.0",
"description": "Webpack-starter project",
"main": " ",
"scripts": {
"dev": "webpack-dev-server --config webpack.config.dev.js",
"build": "webpack --config webpack.config.prod.js --progress"
},
"devDependencies": {
"autoprefixer": "^8.6.5",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-1": "^6.24.1",
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^1.0.0",
"extract-text-webpack-plugin": "^3.0.2",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.4.5",
"node-sass": "^4.9.2",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"postcss-loader": "^2.1.6",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"vue-loader": "15.2.4",
"vue-template-compiler": "^2.5.17",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@tanem/svg-injector": "^8.0.27",
"axios": "^0.19.2",
"babel-polyfill": "^6.26.0",
"body-scroll-lock": "^2.6.4",
"countup.js": "^2.0.4",
"jquery": "^3.3.1",
"slick-carousel": "^1.8.1",
"svg-injector": "^1.1.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"vue": "^2.5.17",
"vue-countup-v2": "^4.0.0",
"vue-dragscroll": "^1.10.0",
"vue-masked-input": "^0.5.2",
"vue-perfect-scrollbar": "^0.2.0",
"vue-resize": "^0.4.5",
"vue-router": "^3.0.1",
"vue-slick": "^1.1.15",
"vuelidate": "^0.7.4",
"vuex": "^3.0.1",
"webpack": "^4.44.1"
}
}
and production webpack config (webpack.config.prod.js
)
process.env.NODE_ENV = 'production';
const path = require("path");
const webpack = require("webpack");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require("copy-webpack-plugin");
let Config = require("./webpack.config.js");
Config.devtool = "cheap-source-map";
Config.mode = 'production';
Config.optimization = {
minimizer: [
new UglifyJsPlugin(),
new OptimizeCSSAssetsPlugin({})
]
};
Config.plugins = (Config.plugins || []).concat([
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, "./assets/"),
to: path.resolve(__dirname, "../Bs.WebApp/wwwroot/assets/")
}
])
]);
module.exports = Config;
Upvotes: 0
Views: 1818
Reputation: 411
Removed new UglifyJsPlugin(),
used afterConfig.optimization.minimize
So that part of the config looks like:
Config.optimization = {
minimizer: [
new OptimizeCSSAssetsPlugin({})
]
};
Config.optimization.minimize;
Upvotes: 1