Skip to content

Commit

Permalink
Merge pull request #268 from alphagov/fix-react-preact-paths
Browse files Browse the repository at this point in the history
Fix asset paths for subdirectories
  • Loading branch information
hannalaakso committed Mar 13, 2018
2 parents aff9bdd + 58f88d4 commit def775c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions webpack.config.babel.js
Expand Up @@ -86,8 +86,13 @@ const config = {

devServer: {
setup (app) {
app.get('/dist/:filename', (request, response) => {
response.redirect('/' + request.params.filename)
// Grab potential subdirectory with :dir*?
app.get('/dist/:dir*?/:filename', (request, response) => {
if (!request.params.dir || request.params.dir === undefined) {
response.redirect('/' + request.params.filename)
} else {
response.redirect('/' + request.params.dir + '/' + request.params.filename)
}
})
},
port: process.env.PORT || 8080,
Expand Down

0 comments on commit def775c

Please sign in to comment.