Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generates namespace objects when not tree-shaking (#4175)
- Loading branch information
1 parent
7435d31
commit 076b608
Showing
5 changed files
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
description: 'generates namespace objects when not tree-shaking', | ||
options: { | ||
treeshake: false | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/form/samples/no-treeshake-namespace-object/_expected.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 @@ | ||
function foo() {} | ||
|
||
var namespace = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
foo: foo | ||
}); | ||
|
||
const a = 1; | ||
const b = 2; | ||
|
||
export { a, b, namespace as ns1, namespace as ns2 }; |
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,8 @@ | ||
import * as ns1 from './namespace'; | ||
|
||
export { ns1 }; | ||
|
||
export * as ns2 from './namespace'; | ||
|
||
export const a = 1; | ||
export const b = 2; |
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 @@ | ||
export function foo() {} |