Skip to content

Commit

Permalink
Don't require package.json to exist for crawlFrameworkPkgs (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
dotcarmen authored Jan 2, 2025
1 parent 277ce18 commit b7b5478
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ export { isDepIncluded, isDepExcluded, isDepNoExternaled, isDepExternaled }
export async function crawlFrameworkPkgs(options) {
const pkgJsonPath = await findClosestPkgJsonPath(options.root)
if (!pkgJsonPath) {
// @ts-expect-error don't throw in deno as package.json is not required
if (typeof Deno !== 'undefined') {
return {
optimizeDeps: { include: [], exclude: [] },
ssr: { noExternal: [], external: [] }
}
} else {
throw new Error(`Cannot find package.json from ${options.root}`)
// don't throw as package.json is not required
return {
optimizeDeps: { include: [], exclude: [] },
ssr: { noExternal: [], external: [] }
}
}
const pkgJson = await readJson(pkgJsonPath).catch((e) => {
Expand Down

0 comments on commit b7b5478

Please sign in to comment.