高级计划前端
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.

49 lines
1.2 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, '.', dir)
  4. }
  5. module.exports = {
  6. chainWebpack: config => {
  7. config.module.rules.delete("svg"); //重点:删除默认配置中处理svg,
  8. config.module
  9. .rule('svg-sprite-loader')
  10. .test(/\.svg$/)
  11. .include
  12. .add(resolve('src/icons')) //处理svg目录(根据你建的文件路径)
  13. .end()
  14. .use('svg-sprite-loader')
  15. .loader('svg-sprite-loader')
  16. .options({
  17. symbolId: 'icon-[name]'
  18. })
  19. },
  20. // 基本路径
  21. publicPath: "./",
  22. // 构建输出目录
  23. outputDir: "dist",
  24. // 静态文件
  25. assetsDir: "static",
  26. // html路径
  27. indexPath: "index.html",
  28. // 文件名哈希
  29. filenameHashing: true,
  30. lintOnSave: false,
  31. // 请求配置
  32. devServer: {
  33. //自动打开浏览器
  34. port: "8080",
  35. host: "localhost",
  36. open: true,
  37. proxy: {
  38. "/user": {
  39. target: process.env.VUE_APP_BASE_URL || "http://101.201.121.115:8098/", //要跨域的域名 目标地址
  40. changeOrigin: true, //是否开启跨域 是否更改源路径
  41. ws: true,
  42. pathRewrite: {
  43. "^/user": "", // /api/ / 凡是/api开头的地址都可以跨域
  44. },
  45. },
  46. },
  47. },
  48. };