Skip to content
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

add emit/updateAsset to Compilation #9687

Merged
merged 1 commit into from Sep 12, 2019
Merged

add emit/updateAsset to Compilation #9687

merged 1 commit into from Sep 12, 2019

Conversation

sokra
Copy link
Member

@sokra sokra commented Sep 11, 2019

add asset info with

  • immutable for long term cache-able asset
  • size for the asset size in bytes
  • development for devtools
  • hotModuleReplacement for HMR assets

show asset info in stats

fixes #9038

What kind of change does this PR introduce?
feature

Did you add tests for your changes?
yes

Does this PR introduce a breaking change?
no

It's backward-compatible with the current way of adding or reading assets.

What needs to be documented once your changes are merged?
stats json has info for assets now, which contains the asset info.

add asset info with
* immutable for long term cache-able asset
* size for the asset size in bytes
* development for devtools
* hotModuleReplacement for HMR assets

show asset info in stats
@webpack-bot
Copy link
Contributor

webpack-bot commented Sep 11, 2019

For maintainers only:

  • This need to be documented (issue in webpack/webpack.js.org will be filed when merged)

@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

this.assets[file] = newSourceOrFunction(this.assets[file]);
} else {
this.assets[file] = newSourceOrFunction;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems making use of ternary operator here would be much better 🤔

this.assets[file] = 
typeof newSourceOrFunction === "function" ?
  newSourceOrFunction(this.assets[file]) :
  newSourceOrFunction;

@webpack-bot
Copy link
Contributor

I've created an issue to document this in webpack/webpack.js.org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Way of determining if an asset's filename contains a hash
5 participants