Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8042 from webpack/bugfix/comments-export-default
keep/restore comments in export default
- Loading branch information
Showing
8 changed files
with
83 additions
and
3 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
11 changes: 11 additions & 0 deletions
11
test/configCases/code-generation/harmony-pure-default/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,11 @@ | ||
import { value as v1 } from "./module1"; | ||
import { value as v2 } from "./module2"; | ||
import { value as v3 } from "./module3"; | ||
import { value as v4 } from "./module4"; | ||
|
||
it("should not execute exports when annotated with pure comment", () => { | ||
expect(v1).toBe(42); | ||
expect(v2).toBe(42); | ||
expect(v3).toBe(42); | ||
expect(v4).toBe(42); | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/configCases/code-generation/harmony-pure-default/module1.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 @@ | ||
let value = 42; | ||
|
||
const inc = () => { | ||
value++; | ||
}; | ||
|
||
export default /*#__PURE__*/inc(); | ||
|
||
export { value }; |
9 changes: 9 additions & 0 deletions
9
test/configCases/code-generation/harmony-pure-default/module2.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 @@ | ||
let value = 42; | ||
|
||
const inc = () => { | ||
value++; | ||
}; | ||
|
||
export default (/*#__PURE__*/inc()); | ||
|
||
export { value }; |
9 changes: 9 additions & 0 deletions
9
test/configCases/code-generation/harmony-pure-default/module3.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 @@ | ||
let value = 42; | ||
|
||
const inc = () => { | ||
value++; | ||
}; | ||
|
||
export default /*#__PURE__*/(inc()); | ||
|
||
export { value }; |
15 changes: 15 additions & 0 deletions
15
test/configCases/code-generation/harmony-pure-default/module4.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 @@ | ||
let value = 42; | ||
|
||
const inc = () => { | ||
value++; | ||
}; | ||
|
||
export | ||
// hello | ||
default | ||
// world | ||
/*#__PURE__*/ | ||
inc() | ||
; | ||
|
||
export { value }; |
7 changes: 7 additions & 0 deletions
7
test/configCases/code-generation/harmony-pure-default/webpack.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,7 @@ | ||
module.exports = { | ||
mode: "production", | ||
optimization: { | ||
minimize: true, | ||
concatenateModules: false | ||
} | ||
}; |