vue.config.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. module.exports = {
  6. configureWebpack: {
  7. externals: {
  8. vue: 'Vue',
  9. vuex: 'Vuex',
  10. 'vue-router': 'VueRouter',
  11. axios: 'axios',
  12. 'element-ui': 'ELEMENT',
  13. 'videojs':'video.js'
  14. }
  15. },
  16. outputDir:'../../public/applet/',
  17. assetsDir:'',
  18. indexPath:'../../public/applet.html',
  19. productionSourceMap: false, // 关键语句
  20. publicPath: process.env.NODE_ENV === 'production' ? './applet/' : '',
  21. css: {
  22. // 是否使用css分离插件 ExtractTextPlugin
  23. // extract: true,
  24. // 开启 CSS source maps?
  25. sourceMap: false,
  26. // css预设器配置项
  27. loaderOptions: {
  28. postcss: {
  29. plugins: [
  30. require('postcss-px2rem-exclude')({ //配置项,详见官方文档
  31. remUnit: 75, // 换算的基数
  32. exclude: /node_modules/
  33. })
  34. ]
  35. },
  36. less: {
  37. javascriptEnabled: true,
  38. globalVars: {
  39. primary: '#fff'
  40. }
  41. }
  42. },
  43. requireModuleExtension: true
  44. },
  45. devServer: {
  46. proxy: {
  47. "/client": {
  48. // zhuangqixiaoguan.com
  49. // h5.zqxg.cc
  50. target: "https://wzh.nczyzs.com/client", //设置你调用的接口域名和端口号 别忘了加http、https
  51. changeOrigin: true, //是否跨域
  52. // secure: true, // 允许https请求
  53. ws: true,
  54. pathRewrite: {
  55. "^/client": "" //这里理解成用‘/api’代替target里面的地址
  56. }
  57. },
  58. "/api": {
  59. target: "https://wzh.nczyzs.com/api", //设置你调用的接口域名和端口号 别忘了加http、https
  60. changeOrigin: true, //是否跨域
  61. // secure: true, // 允许https请求
  62. ws: true,
  63. pathRewrite: {
  64. "^/api": "" //这里理解成用‘/api’代替target里面的地址
  65. }
  66. },
  67. "/mobile": {
  68. target: "https://wzh.nczyzs.com/mobile", //设置你调用的接口域名和端口号 别忘了加http、https
  69. changeOrigin: true, //是否跨域
  70. secure: true, // 允许https请求
  71. ws: true,
  72. pathRewrite: {
  73. "^/mobile": "" //这里理解成用‘/api’代替target里面的地址
  74. }
  75. },
  76. "/index": {
  77. target: "https://wzh.nczyzs.com/index", //设置你调用的接口域名和端口号 别忘了加http、https
  78. changeOrigin: true, //是否跨域
  79. // secure: true, // 允许https请求
  80. ws: true,
  81. pathRewrite: {
  82. "^/index": "" //这里理解成用‘/api’代替target里面的地址
  83. }
  84. },
  85. }
  86. }
  87. }