-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Use HtmlWebpackPlugin to import all assets (importing chunks in order) #1775
Use HtmlWebpackPlugin to import all assets (importing chunks in order) #1775
Conversation
Codecov Report
@@ Coverage Diff @@
## release/3.3 #1775 +/- ##
===============================================
- Coverage 23.14% 23.05% -0.09%
===============================================
Files 253 248 -5
Lines 5756 5703 -53
Branches 691 684 -7
===============================================
- Hits 1332 1315 -17
+ Misses 3924 3889 -35
+ Partials 500 499 -1
Continue to review full report at Codecov.
|
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.
Code looks good to me,
Should we add this behavior to the cra-kitchen-sink to make sure it actually works?
The unit tests for this tests only a really small part of the puzzle. A huge portion is inside webpack, and we'd like to verify it works, not just know the order is correct.
I agree. |
Fine by me, will add =) I'll let you know. |
@Hypnosphi after some digging around CRA, we cannot split bundles yet facebook/create-react-app#2206 (at least, not using the webpack config). Meaning, splitting vendors & app cannot be done easily using the CommonChunksPlugin. Correct me if I'm wrong! I may need then to set some split points inside the code of cra-kitchen-sinks, WDYT ? This way I will be able to give it a name (using the magic comment of webpack import syntax) and test some cases. |
I mean a custom webpack config for storybook, not for app itself |
Ok then, here is my findings:
These two use cases could not be solved using the quick fix in this PR in its current state. When using the statsJson, the https://webpack.js.org/api/stats/#chunk-objects has a Maybe we should consider adding a similar logic as HtmlWebpackPlugin there: https://github.com/jantimon/html-webpack-plugin/blob/master/lib/chunksorter.js ? Please correct me if I'm misunderstanding something, any help appreciated 👍 Also, maybe @SpaceK33z you might want to give us a thought as its webpack's related :) Thanks! |
Hi, this part of webpack is not my area of expertise, but what I can say is that in webpack 4 the order should not matter anymore (source, ctrl+f on 'pure jsonp'). But I realize this will take some time so for now this info is useless 😆. |
Maybe we should consider just using the plugin =) |
@Hypnosphi I implemented a solution to this with HtmlWebpackPlugin. I tried my best with the little knowledge I have from the codebase to not break anything. Could you find the time to try it, and guide me through where I can create test cases to improve this PR ? Thanks in advance ! ps: A a side note, I had issues with addons channels, couldn't really fix it, so I commented out everything addon related to test, with hope this is a development related issue. Please let me know if some is not working :) |
I like where this is going! Great work @thomasbertet |
Works great! Please make the same chages to |
Thanks @ndelangen ! Really appreciate this :-) Will definately do the same for vue. Thanks @Hypnosphi ! |
9aaecd9
to
e3020ce
Compare
@Hypnosphi I added it for vue as well. Ready to take it to the next level, please let me know if I need to do something else. |
I will test this now. |
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.
Tested the regular and static build for cra and vue, works great!
I added a custom webpack config with a vendor chunk for vue too.
@ndelangen should we probably merge it into |
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.
LGTM
I noticed changes for react/vue but not for RN, which also has a very similar webpack/preview setup (in addition to the device side of things). Do we need to change RN as well? |
@shilman As far as I understand, RN app doesn't have a preview entry in webpack config: It probably could still benefit from |
@thomasbertet I think we should try to keep the apps in sync as much as possible. Do you want to bring these changes to the RN app as well? Or do you want me to do it? |
Sure I can try.
Just to be certain, we would like all of them to use the same files, right
? As @Hypnosphi mentioned, is it a design we would like to keep ?
Thanks !
…On Tue, Sep 5, 2017, 07:17 Norbert de Langen ***@***.***> wrote:
@thomasbertet <https://github.com/thomasbertet> I think we should try to
keep the apps in sync as much as possible.
Do you want to bring these changes to the RN app as well? Or do you want
me to do it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1775 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACbvFr1WUYY8U6eoXxLERpDG38nCwl_6ks5sfNlqgaJpZM4PIaYe>
.
|
After Angular app has been merged in, we will be refactoring out most of the duplication. So no it's not our goal to keep it exactly like this; though it's also not a goal to abstract away all forms of duplication. Nothing hurts a codebase more than early abstraction. |
# Conflicts: # app/react/src/server/index.html.js # app/vue/src/server/index.html.js
1e6d0e0
to
bd6d8a6
Compare
@ndelangen this is it =) I added the same behavior for RN & the CRNA example. |
I will test it @thomasbertet, you're awesome! 💪 |
Tested both the crna-example and the react-native-vanilla ✅ |
Great ! Thanks @ndelangen 👍 |
Congrats @thomasbertet ! I hope more PRs like this will follow! 🙇 |
Issue: #1411
What I did
How to test
Is this testable with jest or storyshots?
Not sure how yet.. will do.
Does this need a new example in the kitchen sink apps?
No.
Does this need an update to the documentation?
No.
If your answer is yes to any of these, please make sure to include it in your PR.