vue.config.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const path = require("path");
  2. function resolve(dir) {
  3. return path.join(__dirname, dir);
  4. }
  5. // 增加环境变量
  6. process.env.VUE_APP_VERSION = require("./package.json").version;
  7. process.env.VUE_APP_BUILD_TIME = require("dayjs")().format("YYYY-M-D HH:mm:ss");
  8. module.exports = {
  9. productionSourceMap: false, // 生产环境是否要生成 sourceMap
  10. publicPath: process.env.NODE_ENV === 'production' ? './smartscreen/' : '', //部署应用包时的基本 URL
  11. indexPath:'../../public/smartscreen.html',
  12. outputDir: "../../public/smartscreen/", // 打包时输出的文件目录
  13. lintOnSave: false, //是否在开发环境下每次保存代码时都启用 eslint验证
  14. css: {
  15. loaderOptions: {
  16. // 设置 scss 公用变量文件
  17. less: {
  18. prependData: "@import '~@/lib/public.less';",
  19. },
  20. },
  21. requireModuleExtension: true,
  22. }, // css的处理
  23. chainWebpack: (config) => {
  24. config.resolve.alias
  25. .set("@", resolve("src"))
  26. .set("assets", resolve("src/assets"))
  27. .set("utils", resolve("src/utils"));
  28. }, //vue-cli内部的webpack配置
  29. pluginOptions: {}, // 可以用来传递任何第三方插件选项
  30. devServer: {
  31. proxy: {
  32. "/client": {
  33. target: "https://wzh.nczyzs.com/client", //设置你调用的接口域名和端口号 别忘了加http、https
  34. changeOrigin: true, //是否跨域
  35. // secure: true, // 允许https请求
  36. ws: true,
  37. pathRewrite: {
  38. "^/client": "", //这里理解成用‘/api’代替target里面的地址
  39. },
  40. },
  41. "/dashboard": {
  42. target: "https://wzh.nczyzs.com/dashboard", //设置你调用的接口域名和端口号 别忘了加http、https
  43. changeOrigin: true, //是否跨域
  44. // secure: true, // 允许https请求
  45. ws: true,
  46. pathRewrite: {
  47. "^/dashboard": "", //这里理解成用‘/api’代替target里面的地址
  48. },
  49. },
  50. "/index": {
  51. target: "https://wzh.nczyzs.com/index", //设置你调用的接口域名和端口号 别忘了加http、https
  52. changeOrigin: true, //是否跨域
  53. // secure: true, // 允许https请求
  54. ws: true,
  55. pathRewrite: {
  56. "^/index": "", //这里理解成用‘/api’代替target里面的地址
  57. },
  58. },
  59. },
  60. },
  61. };