vue.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const ENV = process.env.NODE_ENV
  2. const path = require('path')
  3. function resolve (dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. module.exports = {
  7. // indexPath: ENV === 'production' ? '../protected/views/index.html' : 'index.html',
  8. outputDir: './dist', // build 时生成的生产环境构建文件的目录
  9. baseUrl: ENV === 'production' ? '/dist/' : '/',
  10. lintOnSave: true, // 关闭eslint
  11. productionSourceMap: false, // 生产环境取消source map
  12. pages: {
  13. index: {
  14. entry: '_src/pages/index/main.js',
  15. title: 'MeeChat',
  16. filename: ENV === 'production' ? '../protected/views/index.html' : 'index.html'
  17. },
  18. mini: {
  19. entry: '_src/pages/mini/main.js',
  20. template: 'public/mini.html',
  21. title: 'MeeChat',
  22. filename: ENV === 'production' ? '../protected/views/mini.html' : 'mini.html'
  23. }
  24. },
  25. chainWebpack: (config) => {
  26. config.resolve.alias
  27. .set('@', resolve('_src'))
  28. },
  29. css: {
  30. loaderOptions: {
  31. sass: {
  32. data: `@import "@/style/mixins.scss";`
  33. }
  34. }
  35. },
  36. pwa: {
  37. name: 'MeeChat',
  38. workboxPluginMode: 'InjectManifest',
  39. workboxOptions: {
  40. // directoryIndex: null,
  41. importWorkboxFrom: 'disabled',
  42. swSrc: 'public/sw.js'
  43. }
  44. }
  45. }