-
Notifications
You must be signed in to change notification settings - Fork 35
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
All output files register changes with any file change while watching #7
Comments
@jacksonStone You're right, it does seem like the current implementation of this plugin causes all bundles to be rebuilt even when a change only affects one of them. After some playing around it seems like the implementation should ignore chunks that have their
|
Had a chance to give it a whirl. It seems to only rebuild the source file that had changes, however, all source files not built have the wrapper removed, and all sourcemaps are still being constructed. |
Just ran into this as well, however I have some more input - Webpack's emit code keeps a cache based on the This plugin creates a new Source object every time here: wrapper-webpack-plugin/wrapper-webpack-plugin.js Lines 51 to 55 in e1809b1
I haven't looked too deeply into it yet, but adding a cache to the plugin instance using the header/footer + original source object as a key, and returning the previous object if there's a match should avoid these re-emits. (For reference - for our very large web application re-emit on a no-op change to a source file takes about 10s in watch mode, so cutting this down would be a significant win for us) |
This change implements a cache for Sources generated by this plugin so that on subsequent builds (i.e. incremental builds) we can re-use the same Source if the content hasn't changed. This improves performance with Webpack's `futureEmitAssets` mode, where there is a cache based on Source referential identity that determines whether an asset should be re-emitted. Fixes levp#7
When we use this plugin while running a webpack watch, with many output/entry files, all of these files are registering changes if any file has a change. Since most of the file source is cached for rebuilding the output files, output file construction does not seem to take long, but with sourcemaps enabled, all sourcemaps are also rebuilding, taking a lot of time.
This amounts to a watcher change taking close to the same amount of time as a whole webpack build for us.
Do you think there would be any way to add watcher support for this plugin such that it does not trigger changes to everything?
I've been poking around to see what's possible using the source of this project, but it seems if I check the chunk hash for changes and only run your logic on these, all the wrappers for other output files are removed.
Perhaps there is a different event hook that could be tapped into?
The text was updated successfully, but these errors were encountered: