Html-webpack-plugin: Is it possible to have an option to add leading slash to the script src attribute value

Created on 6 Jul 2017  路  3Comments  路  Source: jantimon/html-webpack-plugin

html-webpack-plugin currently generates the following:
<script type="text/javascript" src="booking.js"></script>

This doesn't work for HTML 5mode enabled in our SPA with the current configuration. So, basically, if we reload the page at "fake" url "/foo/bar" and src is like above, booking.js will be served at "/foo/bar/index.html".

Now, if we have the leading slash, like so:
<script type="text/javascript" src="/booking.js"></script>

The index file would be served at /.

Most helpful comment

All 3 comments

@mastilver Oh, thanks a lot! I am new to Webpack, just switched our configuration from a bunch of gulp scripts to a Webpack one, so I am still not familiar with some basic stuff. Thanks again.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings