代码拉取完成,页面将自动刷新
const TerserPlugin = require("terser-webpack-plugin");
var path = require('path');
// const WebpackBundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const CopyWebPackPlugin = require('copy-webpack-plugin');
const productionGzipExtensions = ["js", "css"];
module.exports = {
transpileDependencies: [
/[/\\]node_modules[/\\](.+?)?mermaid(.*)/
],
publicPath: ".",
assetsDir: "webjars",
outputDir: "dist",
lintOnSave: false,
productionSourceMap: false,
indexPath: "doc.html",
css: {
loaderOptions: {
less: {
javascriptEnabled: true
}
}
},
devServer: {
watchOptions: {
ignored: /node_modules/
},
proxy: {
"/": {
//target: 'http://localhost:8990/',
target: 'http://localhost:3000',
/* target: 'http://knife4j.xiaominfo.com/', */
ws: true,
changeOrigin: true
}
}
},
configureWebpack: {
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
ecma: undefined,
warnings: false,
parse: {},
compress: {
drop_console: true,
drop_debugger: true,
pure_funcs: ['console.log', 'console.debug', 'window.console.log', 'window.console.debug'] // 移除console
}
},
}),
]
},
plugins: [
new CompressionWebpackPlugin({
algorithm: "gzip",
test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"),
threshold: 10240,
minRatio: 0.8
}),
new CopyWebPackPlugin([
{ from: path.resolve(__dirname, 'public/oauth'), to: path.resolve(__dirname, 'dist/webjars/oauth') }
])
]
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。