index.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var path = require('path')
  2. module.exports = {
  3. build: {
  4. sitEnv: require('./sit.env'),
  5. prodEnv: require('./prod.env'),
  6. index: path.resolve(__dirname, '../dist/index.html'),
  7. assetsRoot: path.resolve(__dirname, '../dist'),
  8. assetsSubDirectory: 'static',
  9. assetsPublicPath: './', //请根据自己路径配置更改
  10. productionSourceMap: false,
  11. // Gzip off by default as many popular static hosts such as
  12. // Surge or Netlify already gzip all static assets for you.
  13. // Before setting to `true`, make sure to:
  14. // npm install --save-dev compression-webpack-plugin
  15. productionGzip: false,
  16. productionGzipExtensions: ['js', 'css'],
  17. // Run the build command with an extra argument to
  18. // View the bundle analyzer report after build finishes:
  19. // `npm run build --report`
  20. // Set to `true` or `false` to always turn it on or off
  21. bundleAnalyzerReport: process.env.npm_config_report
  22. },
  23. dev: {
  24. hosts: 'localhost',
  25. env: require('./dev.env'),
  26. port: 7759,
  27. autoOpenBrowser: true,
  28. assetsSubDirectory: 'static',
  29. assetsPublicPath: '/',
  30. proxyTable: {
  31. '/api': {
  32. // target: 'http://lswz:9090/api',//服务器网关,
  33. target: 'http://192.168.80.230:8097',
  34. secure: false, // 如果是https接口,需要配置这个参数
  35. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  36. pathRewrite: {
  37. '^/api': ''
  38. },
  39. },
  40. '/loginApi': {
  41. // target: 'http://lswz:9090/api',
  42. target: 'http://192.168.80.230:8097',
  43. secure: false, // 如果是https接口,需要配置这个参数
  44. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  45. pathRewrite: {
  46. '^/dict': ''
  47. },
  48. },
  49. '/fileApi': {
  50. // target: 'http://lswz:9090/api',
  51. target: 'http://192.168.50.127:11010',
  52. secure: false, // 如果是https接口,需要配置这个参数
  53. changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
  54. pathRewrite: {
  55. '^/fileApi': ''
  56. },
  57. },
  58. },
  59. // CSS Sourcemaps off by default because relative paths are "buggy"
  60. // with this option, according to the CSS-Loader README
  61. // (https://github.com/webpack/css-loader#sourcemaps)
  62. // In our experience, they generally work as expected,
  63. // just be aware of this issue when enabling this option.
  64. cssSourceMap: false
  65. }
  66. }