index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // see http://vuejs-templates.github.io/webpack for documentation.
  2. var path = require('path')
  3. var env = '';
  4. if (process.env.NODE_ENV === 'testing') {
  5. env = require('./test.env');
  6. } else if (process.env.NODE_ENV === 'dev') {
  7. env = require('./dev.env');
  8. } else if (process.env.NODE_ENV === 'rc') {
  9. env = require('./rc.env');
  10. } else if (process.env.NODE_ENV === 'import') {
  11. env = require('./import.env');
  12. } else {
  13. env = require('./prod.env');
  14. }
  15. var assetsPublicPath = env.ACCESS_PATH;
  16. console.log('assetsPublicPath=' + assetsPublicPath + '\n');
  17. module.exports = {
  18. build: {
  19. env: require('./prod.env'),
  20. index: path.resolve(__dirname, '../dist/index.html'),
  21. assetsRoot: path.resolve(__dirname, '../dist'),
  22. assetsSubDirectory: 'static',
  23. assetsPublicPath: assetsPublicPath,
  24. productionSourceMap: true,
  25. // Gzip off by default as many popular static hosts such as
  26. // Surge or Netlify already gzip all static assets for you.
  27. // Before setting to `true`, make sure to:
  28. // npm install --save-dev compression-webpack-plugin
  29. productionGzip: false,
  30. productionGzipExtensions: ['js', 'css'],
  31. // Run the build command with an extra argument to
  32. // View the bundle analyzer report after build finishes:
  33. // `npm run build --report`
  34. // Set to `true` or `false` to always turn it on or off
  35. bundleAnalyzerReport: process.env.npm_config_report
  36. },
  37. dev: {
  38. env: require('./dev.env'),
  39. port: 8081,
  40. autoOpenBrowser: true,
  41. assetsSubDirectory: 'static',
  42. assetsPublicPath: '/',
  43. proxyTable: {
  44. '/api':{
  45. //target: 'http://mcatest.bgyfw.com:81/dpshowtest/',
  46. // target: 'http://10.187.16.141:8080/DPshow_depart',
  47. // target: 'http://10.187.31.64:8080',
  48. target: 'http://duptest.bgyfw.com:8081/DPshow_depart',
  49. changeOrigin: true,
  50. }
  51. },
  52. // CSS Sourcemaps off by default because relative paths are "buggy"
  53. // with this option, according to the CSS-Loader README
  54. // (https://github.com/webpack/css-loader#sourcemaps)
  55. // In our experience, they generally work as expected,
  56. // just be aware of this issue when enabling this option.
  57. cssSourceMap: true
  58. },
  59. test: {
  60. env: require('./test.env'),
  61. index: path.resolve(__dirname, '../dist/index.html'),
  62. assetsRoot: path.resolve(__dirname, '../dist'),
  63. assetsSubDirectory: 'static',
  64. assetsPublicPath: assetsPublicPath,
  65. productionSourceMap: true,
  66. // Gzip off by default as many popular static hosts such as
  67. // Surge or Netlify already gzip all static assets for you.
  68. // Before setting to `true`, make sure to:
  69. // npm install --save-dev compression-webpack-plugin
  70. productionGzip: false,
  71. productionGzipExtensions: ['js', 'css'],
  72. // Run the build command with an extra argument to
  73. // View the bundle analyzer report after build finishes:
  74. // `npm run build --report`
  75. // Set to `true` or `false` to always turn it on or off
  76. bundleAnalyzerReport: process.env.npm_config_report
  77. },
  78. rc: {
  79. env: require('./rc.env'),
  80. index: path.resolve(__dirname, '../dist/index.html'),
  81. assetsRoot: path.resolve(__dirname, '../dist'),
  82. assetsSubDirectory: 'static',
  83. assetsPublicPath: assetsPublicPath,
  84. productionSourceMap: true,
  85. productionGzip: false,
  86. productionGzipExtensions: ['js', 'css'],
  87. bundleAnalyzerReport: process.env.npm_config_report
  88. },
  89. import: {
  90. env: require('./rc.env'),
  91. index: path.resolve(__dirname, '../dist/index.html'),
  92. assetsRoot: path.resolve(__dirname, '../dist'),
  93. assetsSubDirectory: 'static',
  94. assetsPublicPath: assetsPublicPath,
  95. productionSourceMap: true,
  96. productionGzip: false,
  97. productionGzipExtensions: ['js', 'css'],
  98. bundleAnalyzerReport: process.env.npm_config_report
  99. },
  100. }