index.js 3.0 KB

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