vue.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const path = require("path");
  2. function resolve(dir) {
  3. return path.join(__dirname, dir);
  4. }
  5. module.exports = {
  6. // 解析SVG组件
  7. chainWebpack(config) {
  8. config.module.rule("svg").exclude.add(resolve("src/icons")).end();
  9. config.module
  10. .rule("icons")
  11. .test(/\.svg$/)
  12. .include.add(resolve("src/icons"))
  13. .end()
  14. .use("svg-sprite-loader")
  15. .loader("svg-sprite-loader")
  16. .options({
  17. symbolId: "icon-[name]",
  18. })
  19. .end();
  20. },
  21. //vue.config.js
  22. css: {
  23. loaderOptions: {
  24. postcss: {
  25. postcssOptions: {
  26. plugins: [require("tailwindcss"), require("autoprefixer")],
  27. },
  28. },
  29. },
  30. },
  31. devServer: {
  32. proxy: {
  33. "/api": {
  34. target: "http://192.168.50.235:16200", //内网
  35. // target: "http://106.120.102.238:16600",//外网
  36. changeOrigin: true,
  37. pathRewrite: {
  38. "^/api": "", //需要rewrite重写的,
  39. },
  40. },
  41. },
  42. },
  43. configureWebpack: {
  44. resolve: {
  45. alias: {
  46. "@": resolve("src"),
  47. },
  48. },
  49. },
  50. };