-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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(ssr): failed ssrLoadModule call throws same error #7177
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.
The fix looks good to me, but I think the tests should be in packages/vite/src/node/ssr/__tests__/ssrModuleLoader.spec.ts
to group the SSR tests.
okay, done. |
This is super nitpicky but this PR isn't quite in line with the behaviour of Node and browsers. If a module throws an error during instantiation, subsequent imports will throw the same error object: let e1, e2;
try {
await import('./bad.js');
} catch (e) {
e1 = e;
}
try {
await import('./bad.js');
} catch (e) {
e2 = e;
}
assert.equal(e1, e2); With this PR, the module is re-instantiated, and a new error is thrown. I was working on a PR separately, unaware this had already been submitted, and the solution I landed on was this — basically, store the error as |
Description
fixes #7030
Additional context
Is the new test file in the correct location?
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).