Skip to content

Instantly share code, notes, and snippets.

@wizardnet972
Created July 17, 2018 15:14
Show Gist options
  • Save wizardnet972/c0444b100f3a918fce1b27688ce94118 to your computer and use it in GitHub Desktop.
Save wizardnet972/c0444b100f3a918fce1b27688ce94118 to your computer and use it in GitHub Desktop.
const path = require('path');
const webpack = require('webpack');
const apiUrl = 'http://localhost:3000';
module.exports = {
outputDir: './dist/public',
chainWebpack: config => {
config.plugin('html').tap(([options]) => [
Object.assign(options, {
template: path.resolve('client/public/index.html')
})
]);
config.set('entry', './src/main.ts');
config.set('context', path.join(__dirname + '/client'));
config.resolve.alias.set('@', path.join(__dirname + '/client/src'));
},
configureWebpack: config => {
return {
plugins: [
new webpack.NormalModuleReplacementPlugin(
/environments\/environment/gi,
result => config.mode === 'production' ? (result.request += '.prod') : result
)
]
};
},
devServer: {
proxy: {
'/api': {
target: apiUrl,
ws: true,
changeOrigin: true
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment