Created
July 17, 2018 15:14
-
-
Save wizardnet972/c0444b100f3a918fce1b27688ce94118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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