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

51 lines
1.3 KiB

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