fix: exclude packages/ from test resolver .js→.ts rewriting
The ESM resolve hook was rewriting .js imports from vendored Pi packages (packages/*/dist/) to .ts, breaking test resolution. Compiled dist/ files need their .js specifiers left intact. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c80d640d35
commit
4b09cd9a91
1 changed files with 2 additions and 1 deletions
|
|
@ -8,8 +8,9 @@
|
|||
export function resolve(specifier, context, nextResolve) {
|
||||
const parentURL = context.parentURL || '';
|
||||
const isFromNodeModules = parentURL.includes('/node_modules/');
|
||||
const isFromPackages = parentURL.includes('/packages/');
|
||||
|
||||
if (!isFromNodeModules && !specifier.startsWith('node:')) {
|
||||
if (!isFromNodeModules && !isFromPackages && !specifier.startsWith('node:')) {
|
||||
// Rewrite .js → .ts
|
||||
if (specifier.endsWith('.js')) {
|
||||
const tsSpecifier = specifier.replace(/\.js$/, '.ts');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue