We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
hasWorkspacePackageJSON
1 parent 8bc1f9d commit 6f6e5deCopy full SHA for 6f6e5de
packages/vite/src/node/server/searchRoot.ts
@@ -27,8 +27,12 @@ function hasWorkspacePackageJSON(root: string): boolean {
27
if (!isFileReadable(path)) {
28
return false
29
}
30
- const content = JSON.parse(fs.readFileSync(path, 'utf-8')) || {}
31
- return !!content.workspaces
+ try {
+ const content = JSON.parse(fs.readFileSync(path, 'utf-8')) || {}
32
+ return !!content.workspaces
33
+ } catch {
34
+ return false
35
+ }
36
37
38
function hasRootFile(root: string): boolean {
0 commit comments