When using html-webpack-plugin to set a filename for a HTML file, the file does not necessarily need to be located in the same folder as output.path. If the filename includes a folder, it will be output to a child folder. This can cause the script assets to have a different public path than the one set in the output.publicPath of webpack.
This PR fixes the public path logic by resolving public path in the following order:
Using the public path provided by html-webpack-plugin
Using the public path set in webpack config by user
Resolve manually using the output name of html file and webpack output path
How has this been tested?
Test with example webpack provided by the issue creator
Test with webpack config that doesn't have folder specified in the filename of html-webpack-plugin options
Description
Fix #447.
When using
html-webpack-plugin
to set a filename for a HTML file, the file does not necessarily need to be located in the same folder asoutput.path
. If the filename includes a folder, it will be output to a child folder. This can cause the script assets to have a different public path than the one set in theoutput.publicPath
of webpack.This PR fixes the public path logic by resolving public path in the following order:
html-webpack-plugin
How has this been tested?
filename
ofhtml-webpack-plugin
optionsTypes of changes
feat
fix
refactor
test
Remarks
N/A