kinit/kinit-uni/vue.config.js
2022-12-04 21:42:59 +08:00

26 lines
770 B
Python
Raw 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.

//vue.config.js
const TransformPages = require('uni-read-pages')
const {webpack} = new TransformPages()
module.exports = {
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
const tfPages = new TransformPages({
// includes 中包含的是router会读取pages路由中的字段名
// 后续如果有用到meta等路由信息可以在 includes 里增加 'meta'
// 在pages路由中写对应的数据router中就可以获取得到
includes: ['path', 'name', 'aliasPath', 'meta']
});
return JSON.stringify(tfPages.routes)
}, true )
})
]
},
devServer: {
port: 8080,
https: false,
disableHostCheck: true // 禁止访问本地host文件
}
}