Skip to content

Commit

Permalink
fix(typescript)!: don't resolve filtered files (#1267) (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
tk-1io committed Jan 6, 2023
1 parent 1a4f2bd commit 796a732
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/typescript/src/index.ts
Expand Up @@ -126,6 +126,7 @@ export default function typescript(options: RollupTypescriptOptions = {}): Plugi

if (resolved) {
if (/\.d\.[cm]?ts/.test(resolved.extension)) return null;
if (!filter(resolved.resolvedFileName)) return null;
return path.normalize(resolved.resolvedFileName);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/typescript/test/test.js
Expand Up @@ -1037,8 +1037,8 @@ test.serial('does it fail for filtering with incorrect rootDir in nested project
plugins: [typescript({ tsconfig: 'tsconfig.json' })]
})
);
// Will throw parse error because it includes a typescript file outside CWD
t.is(error.code, 'PARSE_ERROR');
// It imports a typescript file outside CWD, hence will not get resolved
t.is(error.code, 'UNRESOLVED_IMPORT');
});

test.serial('does manually setting filterRoot resolve nested projects', async (t) => {
Expand Down

0 comments on commit 796a732

Please sign in to comment.