Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vite): remove
resolveId
workaround and update vite-node (#21423)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Roe <daniel@roe.dev>
- Loading branch information
1 parent
6d59a02
commit 5872015
Showing
9 changed files
with
71 additions
and
67 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
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
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
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 |
---|---|---|
|
@@ -33,14 +33,10 @@ export default async (ssrContext) => { | |
} | ||
|
||
function createRunner () { | ||
const _importers = new Map() | ||
return new ViteNodeRunner({ | ||
root: viteNodeOptions.root, // Equals to Nuxt `srcDir` | ||
base: viteNodeOptions.base, | ||
resolveId (id, importer) { _importers.set(id, importer) }, | ||
async fetchModule (id) { | ||
const importer = _importers.get(id) | ||
_importers.delete(id) | ||
id = id.replace(/\/\//g, '/') // TODO: fix in vite-node | ||
return await viteNodeFetch('/module/' + encodeURI(id)).catch((err) => { | ||
const errorData = err?.data?.data | ||
|
@@ -49,7 +45,7 @@ function createRunner () { | |
} | ||
let _err | ||
try { | ||
const { message, stack } = formatViteError(errorData, id, importer) | ||
const { message, stack } = formatViteError(errorData, id) | ||
_err = createError({ | ||
statusMessage: 'Vite Error', | ||
message, | ||
|
@@ -76,7 +72,7 @@ function createRunner () { | |
* @param id {string} | ||
* @param importer {string} | ||
Check warning on line 73 in packages/vite/src/runtime/vite-node.mjs GitHub Actions / lint
|
||
*/ | ||
function formatViteError (errorData, id, importer) { | ||
function formatViteError (errorData, id) { | ||
const errorCode = errorData.name || errorData.reasonCode || errorData.code | ||
const frame = errorData.frame || errorData.source || errorData.pluginCode | ||
|
||
|
@@ -99,7 +95,7 @@ function formatViteError (errorData, id, importer) { | |
|
||
const stack = [ | ||
message, | ||
`at ${loc} ${importer ? `(imported from ${importer})` : ''}`, | ||
`at ${loc}`, | ||
errorData.stack | ||
].filter(Boolean).join('\n') | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.