-
Notifications
You must be signed in to change notification settings - Fork 107
Change how stats file assets are build using emit hook #132
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
base: master
Are you sure you want to change the base?
Conversation
c77b83b to
2da54ab
Compare
| compiler.hooks.compile.tap(this.name, this._handleCompile.bind(this, compiler)); | ||
| compiler.hooks.done.tap(this.name, this._handleDone.bind(this, compiler)); | ||
| compiler.hooks.compile.tap(this.name, this._handleCompile.bind(this)); | ||
| compiler.hooks.emit.tap(this.name, this._handleEmit.bind(this)); |
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.
The emit hook was the only place where we could always access the full list of compiled assets and could access their in-memory contents.
Other hooks tried:
done: we could not access the in-memory content of the filescompilation.processAssets: we do not have to all compiled assets, broke tests where we compressed themassetEmitted: we have access to all files + their in-memory content, however it's not always called without changing the plugin settings, so ended up causing the stats file to have missing files when not used in a dev server environment.
|
This update was also tested using the examples from django-webpack-loader, with and without setting |
| ); | ||
| }); | ||
|
|
||
| it('It should generate the stats file when the plugin runs twice and the output assets already exist', done => { |
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.
This test ensures that even if an asset didn't change between builds, the stats file will always contain its correct info.
No description provided.