const TerserPlugin = require("terser-webpack-plugin");
// const JavaScriptObfuscator = require('webpack-obfuscator');
var HtmlWebpackPlugin = require("html-webpack-plugin");
var path = require("path");
module.exports = {
node: {
global: false,
},
mode: "production",
entry: {
server: "./app.js",
},
output: {
path: path.resolve(__dirname, "dist"),
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
plugins: [
// new JavaScriptObfuscator({
// rotateUnicodeArray: true
// // 数组内是需要排除的文件
// }, ['abc.js']),
// new HtmlWebpackPlugin({
// template: "./html/popup.html", // 源模板文件
// filename: "./popup.html", // 输出文件【注意:这里的根路径是module.exports.output.path】
// showErrors: true,
// inject: "body",
// chunks: ["common", "index"],
// }),
],
// webpack.config.js
resolve: {
// 1.不需要node polyfilss
alias: {
crypto: false,
stream: false,
assert: false,
http: false,
https: false,
util: false,
os: false,
url: false,
fs: false,
fs: false,
net: false,
tls: false,
}
},
};