fix(remix): Use require() to get react-router-dom in Express wrapper.#5796
Merged
AbhiPrasad merged 2 commits intomasterfrom Sep 22, 2022
Merged
fix(remix): Use require() to get react-router-dom in Express wrapper.#5796AbhiPrasad merged 2 commits intomasterfrom
require() to get react-router-dom in Express wrapper.#5796AbhiPrasad merged 2 commits intomasterfrom
Conversation
AbhiPrasad
reviewed
Sep 22, 2022
Contributor
AbhiPrasad
left a comment
There was a problem hiding this comment.
Nice! Can we try testing on vanguard with creating posts as well?
| } | ||
|
|
||
| const url = new URL(request.url); | ||
| const pkg = await import(`${cwd()}/node_modules/react-router-dom`); |
Contributor
There was a problem hiding this comment.
can we not do this package load on every request - or cache it somehow? How about putting it in line 30, where we did it previously?
Contributor
Author
There was a problem hiding this comment.
Just tried out require as a synchronous alternative to put it to line 30, and it also works. Would that make sense?
Also added a post edit route transaction ⬆️
AbhiPrasad
approved these changes
Sep 22, 2022
Contributor
AbhiPrasad
left a comment
There was a problem hiding this comment.
I'm a bit worried about using the require in different environments, but let's
for now!
import() to get react-router-dom in Express wrapper.require() to get react-router-dom in Express wrapper.
Contributor
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
loadModuleutility which we use to acquirereact-router-domcan returnnullwhen called from Express wrapper.I suspect the main reason is that we are not monkey-patching Remix core here, like we are doing in the base implementation, the package acquisition is not guaranteed to run when (or where?)
react-router-domis available.Tried using dynamic imports, and it worked well on https://github.com/getsentry/vanguard
Transaction Before
Transaction After
Parameterized Route Transaction