vue.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const webpack = require('webpack')
  2. const {tuple} = require("ant-design-vue/lib/_util/type");
  3. module.exports = {
  4. pages: {
  5. index: {
  6. // pages 的入口
  7. entry: 'src/main.js',
  8. // 模板来源
  9. template: 'public/index.html',
  10. // 在 dist/index.html 的输出
  11. filename: 'index.html',
  12. // 当使用 title 选项时,
  13. // template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
  14. title: 'Nginx UI',
  15. // 在这个页面中包含的块,默认情况下会包含
  16. // 提取出来的通用 chunk 和 vendor chunk。
  17. chunks: ['chunk-vendors', 'chunk-common', 'index']
  18. },
  19. },
  20. devServer: {
  21. proxy: 'https://nginx.jackyu.cn/api'
  22. },
  23. productionSourceMap: false,
  24. css: {
  25. loaderOptions: {
  26. css: {},
  27. postcss: {},
  28. less: {
  29. javascriptEnabled: true
  30. }
  31. },
  32. extract: false
  33. },
  34. configureWebpack: config => {
  35. config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
  36. if (process.env.NODE_ENV === 'production') {
  37. config.performance = {
  38. hints: 'warning',
  39. // 入口起点的最大体积
  40. maxEntrypointSize: 50000000,
  41. // 生成文件的最大体积
  42. maxAssetSize: 30000000,
  43. // 只给出 js 文件的性能提示
  44. assetFilter: function (assetFilename) {
  45. return assetFilename.endsWith('.js')
  46. }
  47. }
  48. }
  49. }
  50. }