Files
pgserver3.0/pgweb/vue.config.js
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

100 lines
2.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const path = require('path')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
publicPath: process.env.VUE_APP_PUBLIC_PATH,
lintOnSave: process.env.NODE_ENV !== 'production',
// 不输出为编译警告
runtimeCompiler: true,
productionSourceMap: false,
devServer: {
// proxy: 'http://test.cspg_api.ecspg.com/public/index.php/'
// '/': {
// target: 'http://test.cspg_api.ecspg.com/public/index.php/',
// changeOrigin: true
// }
},
configureWebpack: {
resolve: {
alias: {
// 确保路径解析正确
'html2canvas': 'html2canvas/dist/html2canvas.min.js'
}
}
},
chainWebpack: (config) => {
// babel-polyfill 加入 entry
const entry = config.entry('app')
entry
.add('babel-polyfill')
.end()
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.optimization.minimizer([
new TerserPlugin({
terserOptions: {
compress: {
// turn off flags with small gains to speed up minification
arrows: false,
collapse_vars: false, // 0.3kb
comparisons: false,
computed_props: false,
hoist_funs: false,
hoist_props: false,
hoist_vars: false,
inline: false,
loops: false,
negate_iife: false,
properties: false,
reduce_funcs: false,
reduce_vars: false,
switches: false,
toplevel: false,
typeofs: false,
// a few flags with noticable gains/speed ratio
// numbers based on out of the box vendor bundle
booleans: true, // 0.7kb
if_return: true, // 0.4kb
sequences: true, // 0.7kb
unused: true, // 2.3kb
// required features to drop conditional branches
conditionals: true,
dead_code: true,
evaluate: true,
drop_console: true
},
mangle: {
safari10: true
}
},
sourceMap: false,
cache: true,
parallel: true
})
])
},
css: {
// 不生成cssMap文件生成map文件方便调试
sourceMap: false,
loaderOptions: {
less: {
// @是src的别名
data: '@import "@/styles/color.less";'
}
}
},
// 加载less全局变量 https://cli.vuejs.org/zh/guide/css.html#%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8
// 第三方插件
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [path.resolve(__dirname, 'src/styles/color.less')]
}
}
}