Skip to content
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

fix: waku build will bundle browser files in server side #900

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

himself65
Copy link
Contributor

@himself65 himself65 commented Sep 25, 2024

Default options for vite includes browser, whch might cause some bundler issue

Ref: https://v2.vitejs.dev/config/#resolve-conditions
Downstream: run-llama/LlamaIndexTS#1256

Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
waku ⬜️ Ignored (Inspect) Visit Preview Sep 30, 2024 5:04am

Copy link

codesandbox-ci bot commented Sep 25, 2024

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.

@@ -374,6 +380,9 @@ const buildClientBundle = async (
rscTransformPlugin({ isClient: true, isBuild: true, serverEntryFiles }),
...deployPlugins(config),
],
resolve: {
conditions: ['import', 'module', 'default', 'browser', 'production'],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional to have 'default' before 'browser'?

Copy link
Owner

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid committing dist? It's listed in .gitignore.

@@ -112,6 +112,9 @@ const createMainViteServer = (
rscHmrPlugin(),
fsRouterTypegenPlugin(config),
],
resolve: {
conditions: ['import', 'module', 'default'],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MainViteServer is used to bundle for browsers.
It should be in ssr.resolve.conditions.
Do we need to change RscViteServer?

Now I wonder if build.ts change is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested, ssrLoadModule won't use browser condition by default

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what's the original problem?
This MainViteServer it to for browsers, so browser condition should be appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants