-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
feat: Test bundling packages which provide environment depended code parts #484
feat: Test bundling packages which provide environment depended code parts #484
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
@@ -0,0 +1,3 @@ | |||
# SSR Bundling for NPM packages with environment depended code parts | |||
|
|||
Choosing the right code based on the `export` section of the `react-textarea-autosize` module based on the backend server deployment target ('node' | 'webworker') and the client browser. No browser only code should be bundled with server only code. |
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.
To me, it's not our fault that when target=webworker, the bundler picks the browser version, instead of worker version. So, it's our temporarily workaround.
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.
What would you suggest?
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.
Nothing. Sorry for the confusion. It's just a note so that we are on the same page.
@aheissenberger do you know ci is failing? @himself65 can you do a quick review? |
"react-dom": "18.3.0-canary-4b2a1115a-20240202", | ||
"react-server-dom-webpack": "18.3.0-canary-4b2a1115a-20240202", | ||
"react-textarea-autosize": "^8.5.3", | ||
"waku": "0.19.2" |
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.
"waku": "0.19.2" | |
"waku": "workspace:*" |
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.
Oh I think I should change other fixtures also, because they use monorepo actually
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.
It's actually fine. If the version is the same, it will use the workspace version. (And, there's no way to opt-out this behavior, which is actually troublesome.)
Yeah, but to be safe, we can use workspace:*
in all fixtures.
@@ -0,0 +1,28 @@ | |||
import { lazy } from 'react'; | |||
import { defineEntries } from 'waku/server'; | |||
import { Slot } from 'waku/client'; |
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.
error here because you import a package from monorepo.
Solution is add it to references
on tsconfig.json
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 for your contribution!
As you may notice, we should cover more cases in e2e.
As requested #481 this is a simpler Version which does not use screen shots to test results.
Choosing the right code based on the
export
section of thereact-textarea-autosize
module based on the backend server deployment target ('node' | 'webworker') and the client browser. No browser only code should be bundled with server only code.You can simple test this fixture by setting
isNodeCompatible
to false