index.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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, '../eta_front/index.html'),
  10. assetsRoot: path.resolve(__dirname, '../eta_front'),
  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. '/voice':{
  37. target: "http://localhost:3003",
  38. changeOrigin:true, // 如果接口跨域,需要进行这个参数配置
  39. pathRewrite:{
  40. '^/voice':'/voice'
  41. }
  42. },
  43. '/adminapi': {
  44. target: "http://8.136.199.33:7778",
  45. // target: "http://192.168.77.7:8606",
  46. // secure:false, // 如果是https接口,需要配置这个参数
  47. changeOrigin:true, // 如果接口跨域,需要进行这个参数配置
  48. pathRewrite:{
  49. '^/adminapi':'/adminapi'
  50. },
  51. }
  52. },
  53. // CSS Sourcemaps off by default because relative paths are "buggy"
  54. // with this option, according to the CSS-Loader README
  55. // (https://github.com/webpack/css-loader#sourcemaps)
  56. // In our experience, they generally work as expected,
  57. // just be aware of this issue when enabling this option.
  58. cssSourceMap: false
  59. },
  60. test: {
  61. env: !isPreProduction ? require('./prod.test.env') : require('./prod.pre.env'),
  62. index: !isPreProduction ? path.resolve(__dirname, '../eta_front/index.html') : path.resolve(__dirname, '../eta_front/index.html') ,
  63. assetsRoot: !isPreProduction ? path.resolve(__dirname, '../eta_front') : path.resolve(__dirname, '../eta_front'),
  64. assetsSubDirectory: 'static',
  65. // assetsPublicPath: '/vue-admin/',
  66. assetsPublicPath: './',
  67. productionSourceMap: false,
  68. // Gzip off by default as many popular static hosts such as
  69. // Surge or Netlify already gzip all static assets for you.
  70. // Before setting to `true`, make sure to:
  71. // npm install --save-dev compression-webpack-plugin
  72. productionGzip: true,
  73. productionGzipExtensions: ['js', 'css'],
  74. // Run the build command with an extra argument to
  75. // View the bundle analyzer report after build finishes:
  76. // `npm run build --report`
  77. // Set to `true` or `false` to always turn it on or off
  78. bundleAnalyzerReport: process.env.npm_config_report
  79. }
  80. }