Skip to content

Commit

Permalink
fix(#58): guard custom module resolution w/ include and exclude (#59
Browse files Browse the repository at this point in the history
)
  • Loading branch information
SukkaW authored Nov 29, 2023
1 parent 2a3b06a commit b4c4e43
Show file tree
Hide file tree
Showing 7 changed files with 1,166 additions and 3 deletions.
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

0 comments on commit b4c4e43

Please sign in to comment.