index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // see http://vuejs-templates.github.io/webpack for documentation.
  2. var path = require('path')
  3. var argv = process.argv.slice(2);
  4. var isPreProduction = argv.indexOf('preProduction') !== -1;
  5. console.log(argv,isPreProduction);
  6. module.exports = {
  7. build: {
  8. env: require('./prod.env'),
  9. index: path.resolve(__dirname, '../hz_eta/index.html'),
  10. assetsRoot: path.resolve(__dirname, '../hz_eta'),
  11. assetsSubDirectory: 'static',
  12. // assetsPublicPath: '/vue-admin/',
  13. assetsPublicPath: './',
  14. productionSourceMap: false,
  15. // Gzip off by default as many popular static hosts such as
  16. // Surge or Netlify already gzip all static assets for you.
  17. // Before setting to `true`, make sure to:
  18. // npm install --save-dev compression-webpack-plugin
  19. productionGzip: true,
  20. productionGzipExtensions: ['js', 'css'],
  21. // Run the build command with an extra argument to
  22. // View the bundle analyzer report after build finishes:
  23. // `npm run build --report`
  24. // Set to `true` or `false` to always turn it on or off
  25. bundleAnalyzerReport: process.env.npm_config_report
  26. },
  27. dev: {
  28. // 原始配置
  29. env: require('./dev.env'),
  30. host: 'newadmin.brilliantstart.cn', // can be overwritten by process.env.HOST
  31. port: '3030',
  32. autoOpenBrowser: false,
  33. assetsSubDirectory: 'static',
  34. assetsPublicPath: '/',
  35. proxyTable:{
  36. '/adminapi': {
  37. target: "http://8.136.199.33:7778",
  38. // secure:false, // 如果是https接口,需要配置这个参数
  39. changeOrigin:true, // 如果接口跨域,需要进行这个参数配置
  40. pathRewrite:{
  41. '^/adminapi':'/adminapi'
  42. },
  43. }
  44. },
  45. // CSS Sourcemaps off by default because relative paths are "buggy"
  46. // with this option, according to the CSS-Loader README
  47. // (https://github.com/webpack/css-loader#sourcemaps)
  48. // In our experience, they generally work as expected,
  49. // just be aware of this issue when enabling this option.
  50. cssSourceMap: false
  51. },
  52. test: {
  53. env: !isPreProduction ? require('./prod.test.env') : require('./prod.pre.env'),
  54. index: !isPreProduction ? path.resolve(__dirname, '../hz_eta/index.html') : path.resolve(__dirname, '../hz_eta/index.html') ,
  55. assetsRoot: !isPreProduction ? path.resolve(__dirname, '../hz_eta') : path.resolve(__dirname, '../hz_eta'),
  56. assetsSubDirectory: 'static',
  57. // assetsPublicPath: '/vue-admin/',
  58. assetsPublicPath: './',
  59. productionSourceMap: false,
  60. // Gzip off by default as many popular static hosts such as
  61. // Surge or Netlify already gzip all static assets for you.
  62. // Before setting to `true`, make sure to:
  63. // npm install --save-dev compression-webpack-plugin
  64. productionGzip: true,
  65. productionGzipExtensions: ['js', 'css'],
  66. // Run the build command with an extra argument to
  67. // View the bundle analyzer report after build finishes:
  68. // `npm run build --report`
  69. // Set to `true` or `false` to always turn it on or off
  70. bundleAnalyzerReport: process.env.npm_config_report
  71. }
  72. }