index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Template version: 1.3.1
  2. // see http://vuejs-templates.github.io/webpack for documentation.
  3. const path = require('path');
  4. const outPutName = 'static';
  5. module.exports = {
  6. dev: {
  7. baseUrl: '/api',
  8. assetsSubDirectory: 'static',
  9. assetsPublicPath: '/',
  10. proxyTable: {
  11. '/api': {
  12. //target: 'http://127.0.0.1:8180',
  13. target: 'http://120.25.176.175:8290/',
  14. //target: 'http://192.168.0.104:9999',
  15. changeOrigin: true, // 开启代理
  16. // headers: {Host: 'www.sjkepp.com'},
  17. pathRewrite: { '^/api': '/api' }, // 这里重写路径/run就代理到对应地址
  18. },
  19. },
  20. // Various Dev Server settings
  21. host: 'localhost', // can be overwritten by process.env.HOST
  22. port: 8290, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  23. autoOpenBrowser: true,
  24. errorOverlay: true,
  25. notifyOnErrors: true,
  26. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  27. /**
  28. * Source Maps
  29. */
  30. // https://webpack.js.org/configuration/devtool/#development
  31. devtool: 'cheap-module-eval-source-map',
  32. // If you have problems debugging vue-files in devtools,
  33. // set this to false - it *may* help
  34. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  35. cacheBusting: true,
  36. cssSourceMap: true,
  37. },
  38. build: {
  39. baseUrl: '',
  40. // Template for index.html
  41. index: path.resolve(__dirname, `../dist/${outPutName}.html`),
  42. // Paths
  43. assetsRoot: path.resolve(__dirname, '../dist'),
  44. assetsSubDirectory: 'static',
  45. assetsPublicPath: '/',
  46. /**
  47. * Source Maps
  48. */
  49. productionSourceMap: true,
  50. // https://webpack.js.org/configuration/devtool/#production
  51. devtool: '#source-map',
  52. // Gzip off by default as many popular static hosts such as
  53. // Surge or Netlify already gzip all static assets for you.
  54. // Before setting to `true`, make sure to:
  55. // npm install --save-dev compression-webpack-plugin
  56. productionGzip: false,
  57. productionGzipExtensions: ['js', 'css'],
  58. // Run the build command with an extra argument to
  59. // View the bundle analyzer report after build finishes:
  60. // `npm run build --report`
  61. // Set to `true` or `false` to always turn it on or off
  62. bundleAnalyzerReport: process.env.npm_config_report,
  63. },
  64. };