vue.config.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. module.exports = {
  2. outputDir: "shenze",
  3. publicPath: "/shenze",
  4. // publicPath: '/sunzee-stock',
  5. assetsDir: "static",
  6. css: {
  7. extract: false,
  8. },
  9. filenameHashing: true,
  10. configureWebpack: {
  11. output: {
  12. filename: "[name].[hash].js",
  13. chunkFilename: "[id].[hash].chunk.js",
  14. },
  15. },
  16. devServer: {
  17. open: true,
  18. proxy: {
  19. "/": {
  20. target: 'http://120.25.151.99:49022', // 代理地址,这里设置的地址会代替axios中设置的baseURL
  21. // target: "http://120.25.151.99:49011",
  22. // target: 'http://112.74.63.148:49011',
  23. // secure: true, // 使用的是http协议设置为 false,https协议设置为 true
  24. changeOrigin: true, // 是否跨域
  25. pathRewrite: {
  26. // '.+?/api': '/api' // 对反向代理的地址进行重写,因为正确的接口路径是没有/api的,所以需要用'^/api': '/',表示请求接口时去掉api
  27. },
  28. },
  29. },
  30. disableHostCheck: true,
  31. },
  32. chainWebpack: (config) => {
  33. config.plugin('define').tap((definitions) => {
  34. Object.assign(definitions[0], {
  35. __VUE_OPTIONS_API__: 'true',
  36. __VUE_PROD_DEVTOOLS__: 'false',
  37. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false'
  38. })
  39. return definitions
  40. })
  41. }
  42. };