-
Notifications
You must be signed in to change notification settings - Fork 80
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
[WIP]: webpack 4 support #106
Conversation
Hi again, @mhheise! About the file you mentioned:
This file, generated by the plugin, or the be more accureate, by the DllPlugin, here: In the end, this plugin is just an abstraction for the I've noticed that it complains about: This happens when it calls Object.keys(dllConfig.entry)
.map(getManifestPath(settings.hash))
.forEach(manifestPath => {
new DllReferencePlugin({
context: context,
manifest: manifestPath,
}).apply(compiler);
}); That's very interesting... you see, for the DLL to work you have to add the At that point in the AutoDLL plugin's life cycle, the manifest file does not generated yet. The original Btw, here a little tip, if you want to debug the plugin with devtools, you can:
And you should be able to debug the plugin now (: Also, you can install NIM chrome extensions which will popup devtools for you automaticity |
src/plugin.js
Outdated
); | ||
const beforeCompile = params => { | ||
const dependencies = new Set(params.compilationDependencies); | ||
[...dependencies].filter(path => !path.startsWith(cacheDir)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you missed a return
there (:
@asfktz: Thank you so much for the detailed review! I think I am stuck at this point -- I am not sure where and how I would ensure that the EDIT: Perhaps we need an enhancement in webpack to add a hook to the DLL and DLL reference plugins, like what is present in HTML plugin, to indicate when the |
Hmm.. not sure I understand, can you show me an example? thanks! |
Something like this: https://github.com/webpack-contrib/html-webpack-plugin#events |
Hi @mhheise! Sorry for the delay, I got busy lately. I've played around with your code to see what I can help with. Here the changes I made: b2db631...mhheise-feat/webpack-4 The interesting parts are running I haven't got the time to dig into |
@asfktz Thank you!
I think I have most of the I apologize for all of the back-and-forth on this PR -- I'm still new to JS and to open-source contributions! I do appreciate all of the help you've provided so far. |
Cool! Looking forward to seeing this working. If it's ready to be tested I can try it out on my project before we merge this. |
No worries, @mhheise! we're all here to learn 😄 I've found a bug which may relate to the tests being timed out. The plugin exposes a hook called I've noticed that while running the ➜ recommended git:(pr/106) ✗ npm run build
> basic@1.0.0 build /Users/asafkatz/dev/autodll-webpack-plugin/examples/recommended
> webpack
(node:36787) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
AutoDllPlugin: is valid cache? false
AutoDllPlugin: cleanup
AutoDllPlugin: compile
TypeError: compiler.applyPlugins is not a function
at /Users/asafkatz/dev/autodll-webpack-plugin/lib/plugin.js:143:20
at <anonymous> Which I believe related to those lines: if (compiler.hooks) {
compiler.hooks.autodllStatsRetrieved = new SyncHook(['stats', 'source']);
compiler.hooks.autodllStatsRetrieved.call(stats, source);
} else {
compiler.applyPlugins('autodll-stats-retrieved', stats, source);
} Steps to reproduce:
You should see the above error. |
Hi, @emmenko. Thanks! We'll let you know when its ready. |
Will autodll bring some speedup for webpack4? |
It would be good to find out yes 👌 |
The whole thing seems to be working great, except |
the html webpack plugin now works
ok, i got the html-webpack-plugin to work via 2 small changes. Here's a PR to @mhheise 's original PR. https://github.com/mhheise/autodll-webpack-plugin/pull/1 ...for me the integration tests hang on testing usage with > basic@1.0.0 test /Users/jamesgillmore/codementor/autodll/specs/fixtures/basic
> ava --serial specs/*.integration.js
Detect package.json change
Ensure stats retrieved from the currect source
clean run (cache deleted)
Starting the development server...
AutoDllPlugin: is valid cache? false
AutoDllPlugin: cleanup
AutoDllPlugin: compile
The fixtures have been installed etc. Perhaps the integration helpers have to be updated. |
Here it is temporarily if anyone out there wants to give it a try without jumping through any hoops: https://www.npmjs.com/package/autodll-webpack-plugin-webpack-4 |
@faceyspacey HTML plugin hooks should tap after compiler's afterPlugins refer to other html plugin https://github.com/waysact/webpack-subresource-integrity/blob/master/index.js#L338 |
Just wanted to mention this plugin looks nice, but I'm using Webpack 4 so hesitant to try until the official version supports it. (thanks to @faceyspacey though for making most of the code changes needed!) |
@mhheise What are the chances you merge @faceyspacey's work? |
fix($htmlWebpackPlugin): add run hook and use tapAsync for doCompilation
Thanks @faceyspacey. PR has been merged. |
Gave this one a try but I'm running into a couple
|
Base on https://www.npmjs.com/package/autodll-webpack4-plugin https://github.com/zhbhun/autodll-webpack-plugin |
@zhbhun I'm getting |
@klassicd I cannot reproduce the problem, you could try basic example https://github.com/zhbhun/autodll-webpack-plugin/tree/master/examples/basic. |
Hey guys! Any update on this one? |
Hey @zhbhun, I tried your repo with all the example. It's working fine (except 'performance' and 'recommanded' because of a repository not found error (https://github.com/webpack-contrib/html-webpack-plugin doesn't exist). I tried in my own project, and like @pleunv , with your repo or @faceyspacey one, I get errors like that:
Hope it'll help! |
Ok, I found the problem. The problem occurs when dll compile failed. One of the package was missing so the build failed, and the cache was not generated. |
Oh, dll build does't check compilation error. if (err) return reject(err);
if (stats.compilation.errors.length) return reject(stats.compilation.errors); |
Hey guys! Any update on this one? 😿 |
I apologize for the long wait. @mhheise & @faceyspacey, thank you so much for your hard work. It is much appreciated 🙏 I'll take it from here. |
Done (: |
Waited for a long time. Thank you. 👍 |
@asfktz @faceyspacey Thank you for your help! And thank you to all who tested this out and waited patiently 👍 |
WIP: https://github.com/mhheise/autodll-webpack-plugin/tree/feat/webpack-4
Do not merge yet, please!
I would appreciate any feedback you may have 😄
Todo:
package.json
files.webpack
from the command line)compiler.hooks.<identifier>.tap('name', step)
instead ofcompiler.plugin(<identifier>, step)
.compiler.hooks
feature detection to support webpack 3 and webpack 4.Set()
for compilationDependencies (still need to make this backwards compatible).mode
configuration property in webpack configs.Blockers: