I am trying to generate the HTML file at a different location from other webpack built assets. However if I specify an absolute path for the filename option, the generated HTML file is still nested under webpack's output path. I assume this is due to how webpack interprets assets, but is there anyway to get around it?
duplicate of #234 - I believe #250 has a good solution
hope that helps
That's not quite what I want - I want to generate the HTML to a location unrelated to the webpack output path. Also, specifying a nested path in output.filename is a less-than-optimal solution, because then I also have to do so for all other assets such as files processed by file-loader and CSS extracted with extract-text-webpack-plugin. If I want to change the nested folder, I now have to remember to edit all these paths.
It also feels "not working as expected" when you specify an absolute path and instead see it nested under another directory. In fact the fix is pretty simple, as implemented in this PR: https://github.com/ampedandwired/html-webpack-plugin/pull/266
i think i found the solution , i need absolute path too, because i have to deploy in netlify and combine via _redirects file.
my solution :
in webpack config. set output.publicPath to /
...
output: {
filename: "app/[name]-[hash].js",
path: "dist",
publicPath: "/"
},
...
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.
Most helpful comment
That's not quite what I want - I want to generate the HTML to a location unrelated to the webpack output path. Also, specifying a nested path in
output.filenameis a less-than-optimal solution, because then I also have to do so for all other assets such as files processed byfile-loaderand CSS extracted withextract-text-webpack-plugin. If I want to change the nested folder, I now have to remember to edit all these paths.It also feels "not working as expected" when you specify an absolute path and instead see it nested under another directory. In fact the fix is pretty simple, as implemented in this PR: https://github.com/ampedandwired/html-webpack-plugin/pull/266