index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // see http://vuejs-templates.github.io/webpack for documentation.
  2. const path = require('path')
  3. let settings = {}
  4. try {
  5. settings = require('./local.json')
  6. console.log('Using local dev server settings (/config/local.json):')
  7. console.log(JSON.stringify(settings, null, 2))
  8. } catch (e) {
  9. console.log('Local dev server settings not found (/config/local.json)')
  10. }
  11. const target = settings.target || 'http://localhost:4000/'
  12. module.exports = {
  13. build: {
  14. env: require('./prod.env'),
  15. index: path.resolve(__dirname, '../dist/index.html'),
  16. assetsRoot: path.resolve(__dirname, '../dist'),
  17. assetsSubDirectory: 'static',
  18. assetsPublicPath: '/',
  19. productionSourceMap: true,
  20. // Gzip off by default as many popular static hosts such as
  21. // Surge or Netlify already gzip all static assets for you.
  22. // Before setting to `true`, make sure to:
  23. // npm install --save-dev compression-webpack-plugin
  24. productionGzip: false,
  25. productionGzipExtensions: ['js', 'css']
  26. },
  27. dev: {
  28. env: require('./dev.env'),
  29. port: 8080,
  30. settings,
  31. assetsSubDirectory: 'static',
  32. assetsPublicPath: '/',
  33. proxyTable: {
  34. '/api': {
  35. target,
  36. changeOrigin: true,
  37. cookieDomainRewrite: 'localhost'
  38. },
  39. '/nodeinfo': {
  40. target,
  41. changeOrigin: true,
  42. cookieDomainRewrite: 'localhost'
  43. },
  44. '/socket': {
  45. target,
  46. changeOrigin: true,
  47. cookieDomainRewrite: 'localhost',
  48. ws: true
  49. }
  50. },
  51. // CSS Sourcemaps off by default because relative paths are "buggy"
  52. // with this option, according to the CSS-Loader README
  53. // (https://github.com/webpack/css-loader#sourcemaps)
  54. // In our experience, they generally work as expected,
  55. // just be aware of this issue when enabling this option.
  56. cssSourceMap: false
  57. }
  58. }