-
-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: should keep comments of esm export (#8168)
- Loading branch information
1 parent
728a6f4
commit 539b10f
Showing
8 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/rspack-test-tools/tests/configCases/parsing/harmony-export-comment/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { requestEngine } from './share'; | ||
import used from './used'; | ||
|
||
used; | ||
|
||
const content = __non_webpack_require__("fs").readFileSync(__filename, 'utf-8'); | ||
const pureComment = "/* #__PURE__ */"; | ||
it("should keep pure comment of unused export default", () => { | ||
const methodName = "createRequest"; | ||
expect(content).toContain(`${pureComment}${methodName}`) | ||
}); | ||
|
||
it("should keep pure comment of used export default", () => { | ||
const methodName = "function __WEBPACK_DEFAULT_EXPORT__()"; | ||
expect(content).toContain(`${pureComment}${methodName}`) | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/rspack-test-tools/tests/configCases/parsing/harmony-export-comment/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @type {import('@rspack/core').Configuration} | ||
*/ | ||
module.exports = { | ||
entry: "./index.js", | ||
node: { | ||
__dirname: false, | ||
__filename: false | ||
}, | ||
optimization: { | ||
sideEffects: false, | ||
concatenateModules: false, | ||
innerGraph: false | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/rspack-test-tools/tests/configCases/parsing/harmony-export-comment/share.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function createRequest() { | ||
} | ||
function requestEngine() { | ||
|
||
} | ||
|
||
export default /* #__PURE__ */ createRequest(); | ||
|
||
export { requestEngine }; |
9 changes: 9 additions & 0 deletions
9
packages/rspack-test-tools/tests/configCases/parsing/harmony-export-comment/used.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
function fun2() { | ||
|
||
} | ||
|
||
export default /* #__PURE__ */ function () { | ||
} | ||
|
||
export { fun2 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
539b10f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
539b10f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open