You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.8 KiB

  1. /*
  2. * @Author: your name
  3. * @Date: 2020-12-03 09:37:13
  4. * @LastEditTime: 2020-12-04 18:17:46
  5. * @LastEditors: your name
  6. * @Description: In User Settings Edit
  7. * @FilePath: \yxj-web\vue.config.js
  8. */
  9. const path = require("path");
  10. module.exports = {
  11. lintOnSave: false,
  12. outputDir: process.env.NODE_ENV === "development" ? "dist-dev" : process.env.NODE_ENV === "test" ? "dist-test" : "website_h",
  13. publicPath: "./",
  14. configureWebpack: {
  15. resolve: {
  16. alias: {
  17. "@": path.resolve(__dirname, "src"),
  18. style: path.resolve(__dirname, "src/styles"),
  19. },
  20. },
  21. },
  22. // css: {
  23. // loaderOptions: {
  24. // sass: {
  25. // additionalData: `
  26. // @import "~@/assets/styles/_variable.scss";
  27. // `,
  28. // },
  29. // },
  30. // },
  31. chainWebpack: (config) => {
  32. config.module.rules.delete("svg"); //重点:删除默认配置中处理svg,
  33. config.module
  34. .rule("svg-sprite-loader")
  35. .test(/\.svg$/)
  36. .include.add(path.resolve("src/assets/svg/components")) //处理svg目录
  37. .end()
  38. .use("svg-sprite-loader")
  39. .loader("svg-sprite-loader")
  40. .options({
  41. symbolId: "icon-[name]",
  42. });
  43. },
  44. devServer: {
  45. // 环境配置
  46. host: "0.0.0.0",
  47. port: 8082,
  48. https: false,
  49. hotOnly: false,
  50. open: true, //配置自动启动浏览器
  51. disableHostCheck: true, // 本地开发外部可以访问
  52. proxy: {
  53. // 配置多个代理(配置一个 proxy: 'http://localhost:4000' )
  54. "/api": {
  55. // target: "http://121.43.134.227:9100",
  56. // target: "http://192.168.3.55:9100",
  57. target: "https://www.jaxc.cn",
  58. // target: "http://121.41.97.244:9100",
  59. ws: true, //如果要代理 websockets,配置这个参数
  60. changeOrigin: true,
  61. pathRewrite:{
  62. '^/api':'/gzpt'
  63. }
  64. },
  65. },
  66. },
  67. };