index.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. 'use strict'
  2. // Template version: 1.3.1
  3. // see http://vuejs-templates.github.io/webpack for documentation.
  4. const path = require('path')
  5. const DEV_URL = 'http://127.0.3.60'
  6. const PRO_URL = 'http://dsm.mp.dongerkj.com'
  7. const urls = process.env.NODE_ENV === 'development' ? DEV_URL : PRO_URL
  8. console.log(urls)
  9. module.exports = {
  10. dev: {
  11. // Paths
  12. assetsSubDirectory: 'static',
  13. assetsPublicPath: '/',
  14. proxyTable: {
  15. '/': {
  16. target: urls,
  17. secure: false,
  18. changeOrigin: true,
  19. pathRewrite: {
  20. '^/': '/'
  21. }
  22. },
  23. '/': {
  24. target: urls,
  25. secure: false,
  26. changeOrigin: true,
  27. pathRewrite: {
  28. '^/upload': urls+'/upload'
  29. }
  30. },
  31. },
  32. // Various Dev Server settings
  33. host: 'localhost', // can be overwritten by process.env.HOST
  34. // host: '192.168.1.66', // can be overwritten by process.env.HOST
  35. // host: '192.168.1.5', // can be overwritten by process.env.HOST
  36. port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  37. autoOpenBrowser: true,
  38. errorOverlay: true,
  39. notifyOnErrors: true,
  40. poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  41. // Use Eslint Loader?
  42. // If true, your code will be linted during bundling and
  43. // linting errors and warnings will be shown in the console.
  44. useEslint: true,
  45. // If true, eslint errors and warnings will also be shown in the error overlay
  46. // in the browser.
  47. showEslintErrorsInOverlay: false,
  48. /**
  49. * Source Maps
  50. */
  51. // https://webpack.js.org/configuration/devtool/#development
  52. devtool: 'cheap-module-eval-source-map',
  53. // If you have problems debugging vue-files in devtools,
  54. // set this to false - it *may* help
  55. // https://vue-loader.vuejs.org/en/options.html#cachebusting
  56. cacheBusting: true,
  57. cssSourceMap: true
  58. },
  59. build: {
  60. // Template for index.html
  61. index: path.resolve(__dirname, '../dist/index.html'),
  62. // Paths
  63. assetsRoot: path.resolve(__dirname, '../dist'),
  64. assetsSubDirectory: './static/',
  65. assetsPublicPath: '/h5/',
  66. /**
  67. * Source Maps
  68. */
  69. productionSourceMap: true,
  70. // https://webpack.js.org/configuration/devtool/#production
  71. devtool: '#source-map',
  72. // Gzip off by default as many popular static hosts such as
  73. // Surge or Netlify already gzip all static assets for you.
  74. // Before setting to `true`, make sure to:
  75. // npm install --save-dev compression-webpack-plugin
  76. productionGzip: false,
  77. productionGzipExtensions: ['js', 'css'],
  78. // Run the build command with an extra argument to
  79. // View the bundle analyzer report after build finishes:
  80. // `npm run build --report`
  81. // Set to `true` or `false` to always turn it on or off
  82. bundleAnalyzerReport: process.env.npm_config_report
  83. }
  84. }