WMS_PDA/vue.config.js
liufumingren 5ae92e0f63 chore(cli): 由 HBuilderX 工程迁移为 uni-app Vue2 CLI 脚手架工程
- 业务源码统一迁入 src/,H5 模板移到 public/index.html
- 新增 @vue/cli 4.5 + @dcloudio 2.0.2-5020620260917001 全套依赖与 scripts
- 保留 vue.config.js 的 ROUTES 注入(uni-simple-router 运行时依赖)
- 新增 scripts/node-compat.cjs 兼容 Node 23+ 移除的 util.isRegExp 等 API
- README 补充构建/运行/回退说明
2026-10-02 19:45:18 +08:00

28 lines
887 B
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.

/**
* uni-app Vue2 CLI 工程配置
*
* 作用:把 pages.json 的所有页面路由通过 DefinePlugin 注入为全局常量 ROUTES。
* 该常量由 uni-simple-router 内部使用(见 core/router/uni-simple-router.js),
* 缺失会在运行时抛 `ReferenceError: ROUTES is not defined`。
*
* 注意:这里把 TransformPages 的构造放在 runtimeValue 回调里惰性执行,
* 因为 vue.config.js 被 require 时 vue-cli-plugin-uni 还没设置 UNI_INPUT_DIR。
*/
const webpack = require('webpack')
const TransformPages = require('uni-read-pages')
module.exports = {
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
ROUTES: webpack.DefinePlugin.runtimeValue(() => {
const tfPages = new TransformPages({
includes: ['path', 'name', 'aliasPath', 'meta']
})
return JSON.stringify(tfPages.routes)
}, true)
})
]
}
}