[英]ERROR in main.js from Terser when compiling with webpack
So I'm trying to run webpack to compile my code, but when I run npx webpack --config webpack.config.js
I get the following error:所以我试图运行 webpack 来编译我的代码,但是当我运行
npx webpack --config webpack.config.js
我得到以下错误:
ERROR in main.js from Terser
Invalid assignment [main.js:78674,15]
There's not much to go off of, I'm not even sure where to look. go 的内容不多,我什至不知道该去哪里找。 Does anyone have any ideas what might be causing this?
有谁知道可能是什么原因造成的?
Here's my webpack config:这是我的 webpack 配置:
const path = require('path');
module.exports = {
entry: './server.js',
target: "node",
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
publicPath: "/public/"
},
module:{
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-syntax-dynamic-import']
}
}
}
]
},
resolve: {
alias: {
'express-handlebars': 'handlebars/dist/handlebars.js'
}
}
};
Thanks!谢谢!
RESOLVED:解决:
This was an error with assignment where I was assigning process.end.NODE_ENV to a string, which was being compiled into two string assignment:这是分配错误,我将 process.end.NODE_ENV 分配给一个字符串,该字符串被编译成两个字符串分配:
"node-env" = "dev-env"
I resolved this but not minimizing my webpack build:我解决了这个问题,但没有最小化我的 webpack 构建:
optimization: {
minimize: false
}
Then finding the assignment error line from the error output, in the non minified bundle.然后从非缩小包中的错误 output 中找到分配错误行。
Invalid function parameter [bundle.js:186393,23]
Hope this helps someone else.希望这对其他人有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.