vue.config.js 961 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * 配置参考: https://cli.vuejs.org/zh/config/
  3. */
  4. const timestamp = new Date().getTime();
  5. module.exports = {
  6. publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
  7. chainWebpack: (config) => {
  8. const svgRule = config.module.rule("svg");
  9. svgRule.uses.clear();
  10. svgRule
  11. .test(/\.svg$/)
  12. .use("svg-sprite-loader")
  13. .loader("svg-sprite-loader");
  14. },
  15. // 默认打开eslint效验,如果需要关闭,设置成false即可
  16. lintOnSave: false,
  17. productionSourceMap: false,
  18. devServer: {
  19. open: true,
  20. host: "0.0.0.0",
  21. port: 8001,
  22. },
  23. configureWebpack: (config) => {
  24. if (process.env.NODE_ENV === "production") {
  25. return {
  26. output: {
  27. filename: `[name].[hash].${timestamp}.js`,
  28. chunkFilename: `[name].[hash].${timestamp}.js`,
  29. },
  30. performance: {
  31. maxEntrypointSize: 10000000,
  32. maxAssetSize: 30000000,
  33. },
  34. };
  35. }
  36. },
  37. };