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(#58): guard custom module resolution w/ include and exclude #59

Merged
merged 3 commits into from
Nov 29, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@jsdevtools/ez-spawn": "^3.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@swc-node/register": "^1.6.8",
"@swc/core": "^1.3.96",
"@types/chai": "^4.3.10",
Expand Down
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ function swc(options: PluginOptions = {}): RollupPlugin {
return null;
}

if (importer && importee.startsWith('.')) {
// If the importer (the module that is importing the importee) should not be handled by this plugin,
// we skip the resolution to avoid the issue like https://github.com/SukkaW/rollup-plugin-swc/issues/58
if (!filter(importer)) {
return null;
}

if (importer && importee[0] === '.') {
const resolved = resolve(
importer ? dirname(importer) : process.cwd(),
importee
Expand Down
Loading