-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssr): skip rewriting stack trace if it's already rewritten (fixes #…
- Loading branch information
1 parent
9602686
commit feb8ce0
Showing
6 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/vite/src/node/ssr/__tests__/fixtures/modules/has-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
throw new Error() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/vite/src/node/ssr/__tests__/ssrStacktrace.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { fileURLToPath } from 'node:url' | ||
import { test } from 'vitest' | ||
import { createServer } from '../../server' | ||
|
||
const root = fileURLToPath(new URL('./', import.meta.url)) | ||
|
||
async function createDevServer() { | ||
const server = await createServer({ configFile: false, root }) | ||
server.pluginContainer.buildStart({}) | ||
return server | ||
} | ||
|
||
test('call rewriteStacktrace twice', async () => { | ||
const server = await createDevServer() | ||
for (let i = 0; i < 2; i++) { | ||
try { | ||
await server.ssrLoadModule('/fixtures/modules/has-error.js') | ||
} catch (e) { | ||
server.ssrFixStacktrace(e) | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters