Skip to content

Commit

Permalink
fix: update transform error message (#14139)
Browse files Browse the repository at this point in the history
Co-authored-by: patak <[email protected]>
  • Loading branch information
btea and patak-dev authored Oct 9, 2023
1 parent ab103b0 commit e0eb304
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
return
}
// Unexpected error, log the issue but avoid an unhandled exception
config.logger.error(e.message, { error: e })
config.logger.error(`Pre-transform error: ${e.message}`, {
error: e,
timestamp: true,
})
})
}
} else if (!importer.startsWith(withTrailingSlash(clientDir))) {
Expand Down
5 changes: 4 additions & 1 deletion packages/vite/src/node/server/middlewares/indexHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ function preTransformRequest(server: ViteDevServer, url: string, base: string) {
return
}
// Unexpected error, log the issue but avoid an unhandled exception
server.config.logger.error(e.message)
server.config.logger.error(`Pre-transform error: ${e.message}`, {
error: e,
timestamp: true,
})
})
}

0 comments on commit e0eb304

Please sign in to comment.