Skip to content

Instantly share code, notes, and snippets.

@wldcordeiro
Created June 23, 2018 17:11
Show Gist options
  • Save wldcordeiro/b936bdcb613874c18a6ff3d9fcff0c7b to your computer and use it in GitHub Desktop.
Save wldcordeiro/b936bdcb613874c18a6ff3d9fcff0c7b to your computer and use it in GitHub Desktop.
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const config = require('./env.config')
const { AUTHM_GATEWAY_URL, DAM_ROOT_PATH } = config
const rewriteRegex = new RegExp(`^${DAM_ROOT_PATH}/.`)
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
module: {
rules: [{ test: /\.css$/, use: ['style-loader', 'css-loader'] }],
},
devServer: {
compress: false,
port: 3000,
publicPath: DAM_ROOT_PATH,
contentBase: 'public',
disableHostCheck: true,
historyApiFallback: {
rewrites: [{ from: rewriteRegex, to: `${DAM_ROOT_PATH}/index.html` }],
},
proxy: [
{
context: [
'/authorize',
'/auth',
'/token',
'/oauth',
'/requests',
'/request',
'/static',
'/messages',
'/javascript',
'/attask',
'/tile',
'/user',
].concat(
Object.keys(config)
.map(k => config[k])
.filter(
s =>
typeof s === 'string' &&
s !== DAM_ROOT_PATH &&
s.startsWith(DAM_ROOT_PATH)
)
),
target: AUTHM_GATEWAY_URL,
secure: false,
changeOrigin: true,
cookieDomainRewrite: { '*': '' },
},
],
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment