-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Desktop: Improve Webpack resolve configuration #12537
Desktop: Improve Webpack resolve configuration #12537
Conversation
39424a5
to
6225942
Compare
c5dbf64
to
872a683
Compare
what a great find @spen! do you think we could build with and without this PR applied and compare the output JavaScript? I wonder if they are character-for-character identical or not. are there any size differences? |
I remember the Webpack reports reading the same, but they do do some rounding - if I remember right the bundles were something like 5.72mb before and after, comparing with more fidelity would certainly be worthwhile. |
This is great @spen - a zero-diff means we should have high confidence here. Thanks for performing that check. I'm comfortable merging this but I would strongly recommend running it by @gwwar and @ockham and anyone else they recommend so that they can chime in and be aware of the change. Thanks again! |
NP :) Thanks a bunch for taking a look @dmsnell! |
I love faster builds. Changes here seem fine to merge, especially since the target branch is another feature branch. Local dev and desktop seem to spin up great. @spen was there more info on setting the node path? Also summoning @blowery and @aduth if they had more insights. |
Sure thing! :) In In the target branch I've edited this to look up one level now that the relationship between Calypso and desktop have flipped around: https://github.com/Automattic/wp-calypso/pull/12430/files#diff-b1cd36ac3f156ef4dc61bff0f03cf429R98 |
@spen if the |
I'd say it's unrelated (at least directly). |
can you help explain that? basically I want to know if there's any reason we shouldn't go ahead and merge this in Calypso |
Ahh, this PR is based off the desktop merge feature branch and only effects the |
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
Thanks gang <3 |
The aim of these changes is to improve the
resolve
configuration of desktopswebpack.config.js
.Though
moduleDirectories
works for us, it's not quite the correct place to place our application code - instead, these should configured asroot
modules.There's a better explanation in this thread webpack/webpack#472, but here is the main take away:
As a happy side effect, these changes actually give us a decent (~6-11%) reduction in bundle processing time due to the way Webpack attempts to resolve paths using paths within
modulesDirectories
(check out this comment webpack/webpack#472 (comment) for some insight).By running webpack builds with & without these changes a few times I got these timings:
For anybody interested in running the build themselves (run from
/desktop
), make sure to include theNODE_PATH
:Ideally we wouldn't need to add
.json
to theresolve.extensions
array but there's an issue with resolving a json file innode-wpcom-oauth
otherwise.I have a PR open that should fix the reference (Automattic/node-wpcom-oauth#12) and allow us to remove
.json
from the list of extensions.