28 lines
910 B
JavaScript
28 lines
910 B
JavaScript
//vue.config.js
|
|
const TransformPages = require('uni-read-pages')
|
|
const {
|
|
webpack
|
|
} = new TransformPages()
|
|
const consoleDebuggerFlag = process.env.NODE_ENV == 'production'
|
|
module.exports = {
|
|
configureWebpack: config => {
|
|
// console.log("config",config)
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
|
|
const tfPages = new TransformPages({
|
|
includes: ['path', 'name', 'aliasPath']
|
|
});
|
|
return JSON.stringify(tfPages.routes)
|
|
}, true)
|
|
})
|
|
];
|
|
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']
|
|
}
|
|
|
|
}
|
|
} |