Skip to content

Commit

Permalink
fix(skip_module): ambiguous unexpected match (#906)
Browse files Browse the repository at this point in the history
* test: ✅ 复现用例

* fix: 🐛 ident 查找错误

* test: ✅ config skipModules
  • Loading branch information
stormslowly authored Feb 1, 2024
1 parent 8540f69 commit 1023b1b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl TreeShakeModule {
}
}

if ambiguous_named.len() == 1 {
if local_ident.is_none() && ambiguous_named.len() == 1 {
return ambiguous_named.pop();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const assert = require('assert');
const { injectSimpleJest } = require('../../../scripts/test-utils');

injectSimpleJest()
require("./dist/index.js")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"optimizePackageImports": false,
"optimization": {
"skipModules": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sideEffects": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function fn(){}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import fn from './dep.js';

export * from "./types.js"
export * from "./dep.js"

export { fn }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// some comments
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { fn } from "./dep/index.js";

it("the fn should not be undefined", () => {
expect(fn).toBeDefined();
});

0 comments on commit 1023b1b

Please sign in to comment.