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

remove NamedModulesPlugin from production build #2305

Merged
merged 1 commit into from Oct 8, 2017
Merged

remove NamedModulesPlugin from production build #2305

merged 1 commit into from Oct 8, 2017

Conversation

just-boris
Copy link
Contributor

Follow-up for the discussion in #1450 (comment)

All examples are still build, plus there is my two simple demo pages:

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 6fa2803

https://deploy-preview-2305--gatsbygram.netlify.com

@jquense
Copy link
Contributor

jquense commented Oct 2, 2017

I'm catching up with convo in #1450 but my main concern here is that it is going to bust long term caching even more than it is already. I believe with need to replace this with something that provides stable id/names otherwise the overall content hash is gonna constantly change (unless i'm miss understanding the failings of webpack's LTH)

@just-boris
Copy link
Contributor Author

just-boris commented Oct 2, 2017

@jquense your concern is ok, but look at the filenames from my links of the example above. They both end with 4de036b7fc4e26c86a08. Module name is not taken into hash calculation at all.

This is actually the issue, that I am trying to fix. Module name has become different, but filename was not changed. Browser returns cached chunk -> main app.js expects different modules inside -> everything blows up.

Currently at least I will get consistent build output, that doesn't depend from project files location in the file system.

@just-boris
Copy link
Contributor Author

@KyleAMathews the AppVeyor run has failed before the actual build has even started. Do you have a button to restart the build?

@KyleAMathews
Copy link
Contributor

@jquense the fix is we added HashedChunkIdsPlugin and should have removed NamedModulesPlugin at that point but left them both in.

This is where our new custom "HashedChunkIdsPlugin" was added just-boris@f0fccb0#diff-c4777e791f64fbb6c82255341b381dab but NamedModulesPlugin wasn't removed.

I'm a bit fuzzy about what webpack would be doing here but perhaps NamedModulesPlugin isn't even being used?

Maybe?

I want to get off this onto webpack 3 where it seems the situation is mildly more sane.

@jquense
Copy link
Contributor

jquense commented Oct 2, 2017

I'm thinking a bit about the v2 branch where the hashed chunk Ids plugin was removed because it didn't work anymore and we do lean on the named module and chunk plugins for saner LTC, a la https://medium.com/webpack/predictable-long-term-caching-with-webpack-d3eee1d3fa31

@KyleAMathews
Copy link
Contributor

Yeah the hashed chunk ids plugin was just for webpack v1.

@mperkh
Copy link

mperkh commented Oct 4, 2017

Tested removal of NamedModulesPlugin and my builds are clean now and it didnt cause any issues.

@just-boris
Copy link
Contributor Author

just-boris commented Oct 4, 2017

@KyleAMathews good to know that somehow soon-ish we will have a newer version with Webpack 3, where this issue will go away.

But how about merging this, as it resolves the issue immediately, without additional problems?

@KyleAMathews
Copy link
Contributor

Merging and releasing 🎉

@KyleAMathews KyleAMathews merged commit 9b7f9f1 into gatsbyjs:master Oct 8, 2017
@just-boris just-boris deleted the fix/remove-named-plugin branch October 8, 2017 13:44
@just-boris
Copy link
Contributor Author

Thank you!

@jlengstorf
Copy link
Contributor

Hiya @just-boris! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

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

Successfully merging this pull request may close these issues.

None yet

6 participants