pages.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const path = require('path');
  2. const CompressionWebpackPlugin = require("compression-webpack-plugin")
  3. const productionGzipExtensions = ['js', 'css']
  4. function resolve(dir) {
  5. return path.join(__dirname, dir)
  6. }
  7. let title = '';
  8. if (process.env.VUE_APP_NODE_NAME == 'production') {
  9. title = ''
  10. } else if (process.env.VUE_APP_NODE_NAME == 'test') {
  11. title = '(测试)'
  12. } else {
  13. title = '(开发)'
  14. }
  15. const Timestamp = new Date().getTime();
  16. const config = {
  17. //商业园区
  18. business: {
  19. pages: {
  20. index: {
  21. entry: 'src/projects/business/main.js',
  22. template: 'index/business/index.html',
  23. filename: 'index.html',
  24. title: '湖北新生源生物工程有限公司' + title,
  25. }
  26. },
  27. outputDir: 'dist',
  28. devServer: {
  29. host: '0.0.0.0',
  30. port: 8080,
  31. },
  32. chainWebpack: (config) => {
  33. config.entry.app = ['babel-polyfill', '../src/projects/business/main.js']
  34. config.resolve.alias
  35. .set('@', resolve('../src/projects/business/'))
  36. .set('$project', resolve('../src/'))
  37. .set('$root', resolve('../'))
  38. config.plugins.delete('preload-index');
  39. config.plugins.delete('prefetch-index');
  40. config.optimization.minimize(true);
  41. //打包分析添加
  42. //config.output.filename('js/[name].[hash].js').end();
  43. //config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
  44. },
  45. configureWebpack: config => {
  46. config.output.filename = `./static/js/[name].${Timestamp}.js?v=${Timestamp}`
  47. config.output.chunkFilename = `./static/js/[name].${Timestamp}.js?v=${Timestamp}`
  48. },
  49. }
  50. }
  51. const configObj = config["business"]
  52. module.exports = configObj