-
Notifications
You must be signed in to change notification settings - Fork 48
fix: inline optional dependencies when bundling the server #325
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
🦋 Changeset detectedLatest commit: ca4c87c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Very nice 😄
"@opennextjs/cloudflare": patch | ||
--- | ||
|
||
fix: inline optional dependencies when bundling the server |
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 think this changeset could use some extra info
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.
The changelog is mostly for users - I don't think we should describe too much about the implementation details.
But I can add more details to the PR description if you feel like something is missing?
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.
Resolving the convo to merge, but feel free to send your feedback and I'll update the description.
Thanks!
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.
Nono the PR description has everything
What I meant is that if I were a user and I saw: fix: inline optional dependencies when bundling the server
I don't think I would understand what that means/fixes, and I would have questions such as:
- why optional dependencies need to be inlined?
- what does inlining mean?
- what wasn't working before and is now?
Not a huge deal anyways (and you merged as I was writing this comment)
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 think most users do not care about the changelog and how this adapter works. They just want their app to work.
Adding too many info to the changelog might make it more difficult for users to find what they are interested in: the changes they need to do to their app after they update.
IMO
why optional dependencies need to be inlined?
what does inlining mean?
what wasn't working before and is now?
is only of interest for power users - they would know how to find the PR (from the changelog) and check the description and/or the comments in the code.
That being said, one thing I should have mentioned is how this issue manifest (i.e. the generated error).
That's my 2 cents but feel free to add an item to the weekly agenda if you think we should discuss more about that.
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 think most users do not care about the changelog and how this adapter works. They just want their app to work.
Adding too many info to the changelog might make it more difficult for users to find what they are interested in: the changes they need to do to their app after they update.
IMO
why optional dependencies need to be inlined?
what does inlining mean?
what wasn't working before and is now?
is only of interest for power users - they would know how to find the PR (from the changelog) and check the description and/or the comments in the code.
That being said, one thing I should have mentioned is how this issue manifest (i.e. the generated error).
That's my 2 cents but feel free to add an item to the weekly agenda if you think we should discuss more about that.
packages/cloudflare/src/cli/build/patches/plugins/optional-deps.ts
Outdated
Show resolved
Hide resolved
…s.ts Co-authored-by: James Anderson <[email protected]>
Fixes
examples/e2e/pages-router
The regression was introduced in #297
Before that PR,
react-dom/server.edge
was patch before the bundling that happens inbundle-server.ts
.#297 marks
react-dom/server.edge
as external - then it is no more bundled inbundle-server.ts
but it is bundled later bywrangler dev/deploy
.The issue here is that
wrangler dev/deploy
uses the["workerd", "worker", "browser"]
build conditions and then whatever is imported forreact-dom/server.edge
does not match what's expected.The fix in this PR inline dependencies during the bundling in
bundle-server.ts
. We rely on the ESBuild dependency resolution. If an optional dependencies is not found, we require a throwing module. When an optional dependency is actually installed, it will be inlined during the build.Meaning that
react-dom/server.edge
will be inline with the expected build condition (node
)/cc @dario-piotrowicz