fix: require.resolve call not finding @astrojs/check (#8237)

This commit is contained in:
Erika 2023-08-26 11:26:20 +02:00 committed by GitHub
parent 3ad5a2a287
commit 3674584e02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix `astro check` not finding the `@astrojs/check` package

View file

@ -22,7 +22,7 @@ export async function getPackage<T>(
let packageImport; let packageImport;
try { try {
require.resolve(packageName); require.resolve(packageName, { paths: [options.cwd ?? process.cwd()] });
// The `require.resolve` is required as to avoid Node caching the failed `import` // The `require.resolve` is required as to avoid Node caching the failed `import`
packageImport = await import(packageName); packageImport = await import(packageName);