zlpt_app/vue.config.js

28 lines
910 B
JavaScript
Raw Normal View History

2023-12-12 09:14:42 +08:00
//vue.config.js
const TransformPages = require('uni-read-pages')
2023-12-12 14:45:18 +08:00
const {
webpack
} = new TransformPages()
const consoleDebuggerFlag = process.env.NODE_ENV == 'production'
2023-12-12 09:14:42 +08:00
module.exports = {
2023-12-12 14:45:18 +08:00
configureWebpack: config => {
// console.log("config",config)
2023-12-12 09:14:42 +08:00
plugins: [
new webpack.DefinePlugin({
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
const tfPages = new TransformPages({
includes: ['path', 'name', 'aliasPath']
});
return JSON.stringify(tfPages.routes)
2023-12-12 14:45:18 +08:00
}, true)
2023-12-12 09:14:42 +08:00
})
2023-12-12 14:45:18 +08:00
];
if (consoleDebuggerFlag) {
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
}
2023-12-12 09:14:42 +08:00
}
}