-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(remix): Use require()
to get react-router-dom
in Express wrapper.
#5796
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
Conversation
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.
Nice! Can we try testing on vanguard with creating posts as well?
@@ -52,6 +51,8 @@ function wrapExpressRequestHandler( | |||
} | |||
|
|||
const url = new URL(request.url); | |||
const pkg = await import(`${cwd()}/node_modules/react-router-dom`); |
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.
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?
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.
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 ⬆️
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.
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.
size-limit report 📦
|
loadModule
utility which we use to acquirereact-router-dom
can returnnull
when 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-dom
is available.Tried using dynamic imports, and it worked well on https://github.com/getsentry/vanguard
Transaction Before
Transaction After
Parameterized Route Transaction