Skip to content

🐛 add missing entrypoints to origins #13

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

Merged
merged 1 commit into from
May 20, 2019
Merged

🐛 add missing entrypoints to origins #13

merged 1 commit into from
May 20, 2019

Conversation

p-j
Copy link
Contributor

@p-j p-j commented May 16, 2019

Summary

Add missing entrypoints to the origins list

Why

Fixes #8

Background:

  • webpack 3
  • code splitting a large react app

Extract from the webpack.config.js

new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks: isExternal }),
new webpack.optimize.CommonsChunkPlugin({ children: true, minChunks: 3 }),
new webpack.optimize.CommonsChunkPlugin({ name: 'runtime', minChunks: Infinity }),

While investing ways of doing SSR + Code Splitting on a large code base that predates framework like Next.js or React Loadable, I came across React Loadable and your Addon.

After a bit a tinkering I was able to first do a "route level" code splitting with SSR that worked. But the chunks generated shared a lot of code and where pretty big, defeating the purpose of code splitting for us.
I looked for ways to reduce the duplication of dependencies across the chunks and came across this article webpack bits: Getting the most out of the CommonsChunkPlugin()
That's when I added this part:

new webpack.optimize.CommonsChunkPlugin({ children: true, minChunks: 3 }),

and it produced the expected result: the main bundle (entry point) was bigger and the chuncks much smaller.

The issue I faced then is that, when running react-loadable-ssr-addon webpack plugin, the generated manifest was not listing my main entrypoint in the origins anymore for some reason.

That's when I found the issue linked above and the proposed solution, I tested it out and it worked like a charm.

I did not investigate much further, test are passing but I did not add new ones for this use case.

Checklist

  • Your code builds clean without any errors or warnings
  • You are using approved terminology
  • You have added unit tests, if apply.

@p-j p-j changed the title 🐛 add missing entrypoints to origins 🐛 add missing entrypoints to origins May 17, 2019
@themgoncalves themgoncalves added the bug Something isn't working label May 20, 2019
@themgoncalves
Copy link
Owner

themgoncalves commented May 20, 2019

@p-j nice Pull Request!

But before we proceed, I will run some tests to ensure the package stability.

Copy link
Owner

@themgoncalves themgoncalves left a comment

Choose a reason for hiding this comment

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

LGTM, merging pull request.

@themgoncalves themgoncalves merged commit 559c44d into themgoncalves:master May 20, 2019
@themgoncalves
Copy link
Owner

@p-j your fix was release in the v0.1.9.

@p-j
Copy link
Contributor Author

p-j commented May 22, 2019

Thanks @themgoncalves 👍

@p-j p-j deleted the fix/missing-entry-in-origin branch May 23, 2019 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entry points can be incorrectly omitted from origins in assets file
2 participants