-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(browser): don't exclude node builtins from optimization #5082
fix(browser): don't exclude node builtins from optimization #5082
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
@@ -81,6 +81,13 @@ export default (project: WorkspaceProject, base = '/'): Plugin[] => { | |||
}, | |||
} | |||
}, | |||
transform(code, id) { | |||
if (id.includes('loupe/loupe.js')) { |
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.
We can just bundle loupe
to be honest, but then we should probably bundle chai
, but I don't see that happening 🤷🏻
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 in case, can you clarify the issues with bundling chai
?
I guess the obvious one is that it affects vitest's package size. Another one I thought about is that a user code relying on import "chai"
would end up with different instance of chai
from what Vitest sees internally.
Do you have anything else in mind?
@hi-ogawa what do you think? We don't want Vite to bundle it because it adds an import from |
Oh, I wasn't aware that node builtins were in From this comment #4892 (comment), I thought we could simply add
What do you mean by it adds |
We probably forgot to remove it when we provided polyfills ourselves.
It transforms |
Description
Fixes #4535
Fixes #4892
Possibly fixes #5046
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.