-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack 5 <-> html-webpack-plugin 5 #1527
Comments
FWIW, (It's still pretty inconvenient to have to hook into the compilation in two fundamentally different ways, depending on whether you're using |
good news, waiting 👍 |
and When is it expected to be released? |
@jeffposnick I have an idea to fix your issue - can you please try the Instead of extracting the result of the child compiler it will now extract the assets inside a child compiler hook:
@tianyingchun hard to say - depends a little bit on my time :) |
I'm seeing different behavior, but not having luck getting access to the assets created by
First off, I see the following originating from
And at the time my plugin runs, I don't see the expected I am curious as to whether you really need to go through the steps of deleting your assets from the child compilation and adding them to the parent compilation—maybe someone from the My plugin, at least, already iterates over both the parent and any child compilations to get the asset list from each. |
💯 My projects totally want to upgrade to webpack@5 exception |
@jeffposnick okay good to know that the temporary file disappeared - now I just need to use the same api to add it once again. Deleting the compiled template from the child compilation as it will be processed even further before it is added again with the final name. It also allows to compile a template only once even if it is used to generate multiple html files. |
There seems to be a blocker - if I move the asset additions away from the emit phase the child compilation is not done. |
I pushed the current version as |
Wow @sokra improved the |
I have just released [email protected] (which requires webpack 5.1.2) - it is now adding the assets the right way @jeffposnick could you please try it once again? |
@jantimon
|
Thanks for testing @tianyingchun - it looks like this release didn't include all changes - can you please try one more time with Now it's part of [email protected] ? |
I don't have this problem anymore. Well done 👍 |
@jantimon yes the
finnally it give an error
|
@tianyingchun I am not sure how this would be connected to the html-webpack-plugin.. if it is could you please open a new issue for that part? |
ok, i will research this issue first, thanks very much. 👍 |
alpha-5 still can not success build it throws error like https://github.com/jantimon/html-webpack-plugin/issues/1451 |
alpha.6 is working fine with my simple webconfig. I say simple since 4.5.0 also was working while using webpack 5 |
For me it seems inject: false isn't properly respected - I still get script tags (in headTags). PS. Sorry for not having a proper repro (no time), but I thought it be nice for everybody to hear about it anyway. |
@cjblomqvist as you can see |
So far the feedback of the beta is quite good - there is only one bigger bug which seems to be caused by a webpack bug. (webpack/webpack#12283) @AviVahl thanks for your feedback |
beta.4 works well from my end. Thanks for the fixes ❤️ |
Very very cool progress @jantimon! Thank you so much! |
Hello @jantimon, I have some issues with html-webpack-harddisk-plugin along side [email protected].
In production mode, I generates 2 index.html files. So first one is generated at the right place (following my I hope I was clear enough :) |
@Thebarda thanks for you feedback - can you please create an issue directly for the html-webpack-hardisk-plugin with a little bit more info which css urls you would expect and which you get instead? |
FYI, I fixed it by moving the file path into
It produces an HTML file at the right place with the right hash inside CSS urls |
FYI for anyone interested, webpack/webpack#12283 was resolved in |
It looks like everything works well so I will release html-webpack-plugin 5.x as a stable release soon |
Ok, then just press "merge" button :) we are getting DEP_WEBPACK_COMPILATION_ASSETS with current version. Thank you! |
@jantimon sounds good - any issues blocking the v5 release? |
looks like webpack 5 support was merged to master yesterday but has not been released, is that intentional? |
@jantimon thank you for your amazing work. I guess we are all looking forward for the release. Would love to see this nasty Is there anything that blocks the release right now? We are using only the small subset of the plugin features, but I've tried the |
released as html-webpack-plugin 5.0.0 |
please add info in release that it supports webpack 5. |
@olegKusov it's already in the changelog: https://github.com/jantimon/html-webpack-plugin/blob/main/CHANGELOG.md#500-2021-02-03
|
Finally Webpack 5 has been released! 👍
During the beta I tried to provide a html-webpack-plugin version which is compatible to webpack 4 and webpack 5.
As there have been some API and typing changes in webpack 5 this approach is limited.
To provide the best possible webpack 5 support I have started on a dedicated webpack 5 version of the html-webpack-plugin.
current progress:
drop webpack 4 support
drop node < 10 like webpack
make use of Compiler.hook.initialize to get the latest options
update typings for webpack 5
fix scriptLoading defer for inject false
make scriptLoading defer the default
add assets in Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL (see Guidance on porting a plugin to webpack v5? webpack/webpack#11425 (comment) )
add assets with new api
compilation.emitAsset
(Strange asset name when used with webpack v5.0.0-rc.3 #1522)use
new webpack.sources.RawSource(html)
to create assetsadd support for
[name]
provide options and output name in all hooks
allow filename to be a function
emitAssets even if they have been generated in a previous compilation (to fix index.html disappear with watch mode (HtmlWebpackPlugin) #1476 and html was not generated in watch mode, after changing one of the files #1432)
use
compiler.webpack.LibraryTemplatePlugin
verify support for raw-loader (blocked by Webpack 5 - child compiler ignores library target / name options webpack/webpack#11909)
remove
@types/tapable
as it is included in tapable 2provide a publicPath to the child compiler to add support for
publicPath: 'auto'
&'asset/resource'
(assets modules won't work for inline html <img> webpack/webpack#11968 (comment))use the correct stage to allow sri and service worker generation (blocked by Extend Webpack Compilation Stages webpack/webpack#11822)
fix error reporting (which is currently breaking the travis build)
use the html-webpack-plugin
publicPath
option also for the template child compilationremove html-minification (if a separate plugin which covers the html minification is available)(postponed)current blockers (help needed by the webpack team):
current alpha playround:
CodeSandbox of the html-webpack-plugin 5.0.0-alpha.17
Most of the work is done just by me in my spare time for fun - so if this work helps you feel free to buy me a beer 🍺
The text was updated successfully, but these errors were encountered: