feat: don't override async bundle paths searchParams in prod#1509
feat: don't override async bundle paths searchParams in prod#1509jbroma wants to merge 4 commits intofacebook:mainfrom
Conversation
|
Hey! |
|
hey @vzaidman 👋, I've taken that from here: (although that might have been an over-interpretation on my side 😅) |
|
@vzaidman is there anything we can do about this PR to move forward with it? 🙏 |
|
@jbroma sorry about the delay with this. Could you remind me - is there a functional difference intended here (eg MF using different defaults, so we want to leave these params implicit), or is this purely tidying up? |
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
No worries, I feel like we got a little bit sidetracked and left those PRs be for the past month or so, so sorry about that too 😅 So this PR is mostly about tidying up the bundle output in production mode. This PR is completely optional for Module Federation but it cleans up the split module IDs by removing the query params from them. This should not be breaking in any way because if the query params in question are already there they will be replaced just like before - and that seems to be the case, even for nested lazily imported bundles. |
|
@jbroma I just had a closer look at this and notice the params we set here are the opposite of the defaults: So these params are overrides to Metro defaults, and they're typically necessary when loading additional module definitions into an existing bundle from the Metro server (you don't need the bundle boilerplate hence The effect of this PR is that if you don't explicitly specify For your use case, I guess you're loading prebuilt bundles in prod and so the query params are just noise. But I think the more correct approach for that is to manipulate the URL only when loading from the dev server, rather than basing it on whether the particular params are present. |
|
Ah, that makes sense, haven't thought of that implicit edge case. I'll rework this to a dev-only feature then 👍 Thanks for investigating this deeply 🙏 |
c7e3853 to
c6c1d36
Compare
c6c1d36 to
1baf4ef
Compare
|
@robhogan I've aligned the PR to prevent overriding async bundle paths in prod only 👍 |
|
hey @robhogan 👋 anything left to do here to move forward with this PR? |
Summary
Part of #1480
When implementing Module Federation for Metro, we're reusing existing lazy bundling for production bundles, and we wanted to clean up the bundlePaths for the production bundles by not adding any query params to it. Since the
searchParamsare entirely based onsourceUrl, we can avoid addingsearchParamsby having a cleansourceUrl.This PR does two things:
runModule&modulesOnlyparams happen only in dev?to the URL when there are nosearchParamsChangelog: [Feature] Prevent adding runModule & modulesOnly search params when processing bundle async paths for production bundles
Test plan