vue.config.js 1.1 KB

12345678910111213141516171819202122232425
  1. // vue.config.js - disable thread-loader for compatibility
  2. // 2026-11-03 H5 部署配置:
  3. // - publicPath:生产构建产物以 /frontend/ 为根(配合 cfc.iwintrue.com/frontend 反代);
  4. // dev 模式保持 '/'(dev server 直接访问 http://127.0.0.1:8551/ 不受影响)
  5. // - devServer.port:uni-app H5 dev server 端口 8081 → 8551(原 8080 被 gogs 占用)
  6. module.exports = {
  7. parallel: false, // Ensure we use the correct source directory
  8. publicPath: process.env.NODE_ENV === 'production' ? '/frontend/' : '/',
  9. pages: undefined,
  10. devServer: {
  11. port: 8551
  12. },
  13. configureWebpack: {
  14. resolve: {
  15. extensions: ['.vue', '.js', '.json'], // Ensure .vue files resolve correctly
  16. },
  17. // node:false 会禁用 global/process polyfill,uni-app H5 运行时在浏览器访问 global 报
  18. // "global is not defined"(模块 1d50:global.__uniConfig / global["____DA59D6D____"])。
  19. // 改用 webpack4 node 配置:注入 global(=> window)与 process,兼容 uni-app H5 运行时。
  20. node: {
  21. global: true,
  22. process: true,
  23. },
  24. },
  25. }