1
0

vue.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: {
  22. '/ws': {
  23. target: 'wss://nginx.jackyu.cn/api',
  24. changeOrigin: true,
  25. pathRewrite: {
  26. '^/ws': '',
  27. },
  28. },
  29. '': {
  30. target: 'https://nginx.jackyu.cn/api',
  31. }
  32. }
  33. },
  34. productionSourceMap: false,
  35. css: {
  36. loaderOptions: {
  37. css: {},
  38. postcss: {},
  39. less: {
  40. javascriptEnabled: true
  41. }
  42. },
  43. extract: false
  44. },
  45. configureWebpack: config => {
  46. config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
  47. if (process.env.NODE_ENV === 'production') {
  48. config.performance = {
  49. hints: 'warning',
  50. // 入口起点的最大体积
  51. maxEntrypointSize: 50000000,
  52. // 生成文件的最大体积
  53. maxAssetSize: 30000000,
  54. // 只给出 js 文件的性能提示
  55. assetFilter: function (assetFilename) {
  56. return assetFilename.endsWith('.js')
  57. }
  58. }
  59. }
  60. }
  61. }