Files
habitica/website/client/vue.config.js
Matteo Pagliazzi 33b26a69b8 config fixes
2019-10-01 16:23:09 +02:00

67 lines
1.6 KiB
JavaScript

// TODO abstract from server
const path = require('path');
const nconf = require('nconf');
const setupNconf = require('../../website/server/libs/setupNconf');
let configFile = path.join(path.resolve(__dirname, '../../config.json'));
setupNconf(configFile);
const DEV_BASE_URL = nconf.get('BASE_URL');
module.exports = {
chainWebpack: config => {
const pugRule = config.module.rule('pug')
// clear all existing loaders.
// if you don't do this, the loader below will be appended to
// existing loaders of the rule.
pugRule.uses.clear()
// add replacement loader(s)
pugRule
.test(/\.pug$/)
// this applies to <template lang="pug"> in Vue components
.oneOf('vue-loader')
.resourceQuery(/^\?vue/)
.use('pug-plain')
.loader('pug-plain-loader')
.end()
.end()
},
devServer: {
proxy: {
// proxy all requests to the server at IP:PORT as specified in the top-level config
'^/api/v3': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/api/v4': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/stripe': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/amazon': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/paypal': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/logout-server': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/export': {
target: DEV_BASE_URL,
changeOrigin: true,
},
}
}
};