Skip to content

feat(index): add [contenthash] support #30

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

Closed
wants to merge 3 commits into from
Closed

feat(index): add [contenthash] support #30

wants to merge 3 commits into from

Conversation

chenxsan
Copy link
Contributor

@chenxsan chenxsan commented Mar 9, 2018

Issues

First time doing webpack plugin code :) Hope it won't break anything.

@codecov
Copy link

codecov bot commented Mar 9, 2018

Codecov Report

Merging #30 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@         Coverage Diff          @@
##           master   #30   +/-   ##
====================================
  Coverage       0%    0%           
====================================
  Files           3     3           
  Lines         157   167   +10     
  Branches       32    34    +2     
====================================
- Misses        125   133    +8     
- Partials       32    34    +2
Impacted Files Coverage Δ
src/index.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e062cd2...db8d63a. Read the comment docs.

@developer-lindner
Copy link

Documentation should be updated as well!

@vertic4l
Copy link

vertic4l commented Mar 9, 2018

Let's get this merged @sokra :)

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

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

@chenxsan Thx

@vertic4l
Copy link

@michael-ciniawsky any time table when this gets merged finally?

@michael-ciniawsky
Copy link
Member

@vertic4l I don't have access here, that's up to Tobias atm :), From my side it's g2g, the only thing notable here is that the hash of the JS chunk will nevertheless change when the CSS changes...

@michael-ciniawsky
Copy link
Member

So it mitigates caching problems at best (the CSS will keep the hash)

@vertic4l
Copy link

vertic4l commented Mar 16, 2018

@michael-ciniawsky well, i can't actually close my own PR within a project (which updates to webpack 4 setup) as long as this plugin or ExtractTextPlugin doesn't work properly with incremental builds, contentHash and webpack 4. Pretty annoying actually, but can't really help either :/

// add contenthash support
compiler.hooks.emit.tap(pluginName, (compilation) => {
const regexp = /\[(?:(\w+):)?contenthash(?::([a-z]+\d*))?(?::(\d+))?\]/ig;
Object.keys(compilation.assets).forEach((filename) => {
Copy link

Choose a reason for hiding this comment

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

What about object.entries?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not available in node 6.

@michael-ciniawsky michael-ciniawsky changed the title Add contenthash support feat(index): add [contenthash] support Mar 20, 2018
@michael-ciniawsky michael-ciniawsky added this to the 0.3.0 milestone Mar 20, 2018
@sokra
Copy link
Member

sokra commented Mar 20, 2018

I'll add [contenthash] support to the webpack core, as this is also needed for js files when CSS is part of the chunk.

Thanks for your PR anyway.

@sokra sokra closed this Mar 20, 2018
@KyleAMathews
Copy link

So would we then want to use [contenthash] for js chunks too?

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

Successfully merging this pull request may close these issues.

8 participants