index.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. '/oauth/revoke': {
  51. target,
  52. changeOrigin: true,
  53. cookieDomainRewrite: 'localhost'
  54. }
  55. },
  56. // CSS Sourcemaps off by default because relative paths are "buggy"
  57. // with this option, according to the CSS-Loader README
  58. // (https://github.com/webpack/css-loader#sourcemaps)
  59. // In our experience, they generally work as expected,
  60. // just be aware of this issue when enabling this option.
  61. cssSourceMap: false
  62. }
  63. }