Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
2 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
15 changes: 15 additions & 0 deletions
15
test/configCases/scope-hoisting/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,15 @@ | ||
import x1, { value as v1 } from "./module1"; | ||
import x2, { value as v2 } from "./module2"; | ||
import { value as v3 } from "./module3"; | ||
import x4, { 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); | ||
}); | ||
|
||
var x = /*#__PURE__*/(function() { | ||
return x1 + x2 + x4; | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/configCases/scope-hoisting/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/scope-hoisting/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/scope-hoisting/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/scope-hoisting/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/scope-hoisting/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: true | ||
} | ||
}; |