Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typescript)!: don't resolve filtered files (#1267) #1310

Merged
merged 1 commit into from Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/typescript/src/index.ts
Expand Up @@ -125,6 +125,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 @@ -999,8 +999,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