星火管控前端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

vue.config.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const { defineConfig } = require("@vue/cli-service");
  2. const timestamp = new Date().getTime();
  3. //生产环境标记
  4. const IS_PRODUCTION = process.env.NODE_ENV === "production";
  5. // 生产配置
  6. const cdn_production = {
  7. js: ["/librarys/vue@2.6.11/vue.min.js"]
  8. };
  9. // 开发配置
  10. const cdn_development = {
  11. js: ["/librarys/vue@2.6.11/vue.js"]
  12. };
  13. module.exports = defineConfig({
  14. lintOnSave: false,
  15. productionSourceMap: !IS_PRODUCTION, //打包不生成map文件
  16. devServer: {
  17. open: false
  18. },
  19. css: {
  20. extract: IS_PRODUCTION
  21. ? {
  22. filename: `css/[name].${timestamp}.css`,
  23. chunkFilename: `css/[name].${timestamp}.css`
  24. }
  25. : false,
  26. loaderOptions: {
  27. less: {
  28. lessOptions: {
  29. javascriptEnabled: true
  30. }
  31. }
  32. }
  33. },
  34. configureWebpack: {
  35. output: {
  36. filename: `js/[name].${timestamp}.js`,
  37. chunkFilename: `js/[name].${timestamp}.js`
  38. },
  39. // 排除不引用
  40. externals: {
  41. vue: "Vue",
  42. "vue-router": "VueRouter",
  43. vuex: "Vuex",
  44. echarts: "echarts",
  45. axios: "axios",
  46. xlsx: "XLSX2",
  47. "xlsx-style": "XLSX",
  48. "view-design": "iview",
  49. "crypto-js": "CryptoJS"
  50. }
  51. },
  52. chainWebpack: (config) => {
  53. config.plugin("html").tap((args) => {
  54. args[0].cdn = IS_PRODUCTION ? cdn_production : cdn_development;
  55. return args;
  56. });
  57. }
  58. });