vue.config.js 1.9 KB

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