I have an app which runs express js and angular 2 I am using webpack to bundle my modules and webpack dev middleware to run webpack with express.
I have setup express js to have a wildcard route to serve the index.html file however, when I attempt to hit localhost:8080/login the webpack-html-plugin isnt adding in the js and css assets at all.
app.get('*', function (request, response) {
response.sendFile(path.join(__dirname, '../../../../client/src/index.html'));
}
if I hit localhost:8080 (home page) the assets are added correctly I can only guess this is handled by the public path because when I change the public path to /login/ the login route works but the home page doesn't?
Is there anyway to make it serve the assets to other routes?
very similar to Webpack + Angular2 wrong publicPath?
My Repo is public so if you wouldn't mind taking a look that would be great!
I managed after many hours of browsing to stumble upon this gem which helped me solve this issue hopefully it helps others too.
https://github.com/ampedandwired/html-webpack-plugin/issues/145