Smarter webpack dev server config

This commit is contained in:
Eliot Berriot 2018-03-29 23:24:42 +02:00
parent b852a92a67
commit 1ec705ba3f
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
1 changed files with 22 additions and 10 deletions

View File

@ -29,19 +29,31 @@ module.exports = {
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
'**': {
target: 'http://nginx:6001',
changeOrigin: true,
ws: true
ws: true,
filter: function (pathname, req) {
let proxified = ['.well-known', 'staticfiles', 'media', 'instance', 'api']
let matches = proxified.filter(e => {
return pathname.match(`^/${e}`)
})
return matches.length > 0
}
},
'/media': {
target: 'http://nginx:6001',
changeOrigin: true,
},
'/staticfiles': {
target: 'http://nginx:6001',
changeOrigin: true,
}
// '/.well-known': {
// target: 'http://nginx:6001',
// changeOrigin: true
// },
// '/media': {
// target: 'http://nginx:6001',
// changeOrigin: true,
// },
// '/staticfiles': {
// target: 'http://nginx:6001',
// changeOrigin: true,
// },
},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README