-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly render dynamic imports when imported module is empty (#2714)
- Loading branch information
1 parent
792cd85
commit e8c078d
Showing
13 changed files
with
54 additions
and
1 deletion.
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
6 changes: 6 additions & 0 deletions
6
test/chunking-form/samples/dynamic-import-only-reexports/_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,6 @@ | ||
module.exports = { | ||
description: 'handles dynamic imports when the imported module only reexports from other modules', | ||
options: { | ||
input: ['main'] | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/dynamic-import-only-reexports/_expected/amd/generated-chunk.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 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
const value = 42; | ||
|
||
exports.value = value; | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/dynamic-import-only-reexports/_expected/amd/main.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,5 @@ | ||
define(['require'], function (require) { 'use strict'; | ||
|
||
new Promise(function (resolve, reject) { require(['./generated-chunk.js'], resolve, reject) }).then(({ value }) => console.log(value)); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/dynamic-import-only-reexports/_expected/cjs/generated-chunk.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,5 @@ | ||
'use strict'; | ||
|
||
const value = 42; | ||
|
||
exports.value = value; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/dynamic-import-only-reexports/_expected/cjs/main.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,3 @@ | ||
'use strict'; | ||
|
||
Promise.resolve(require('./generated-chunk.js')).then(({ value }) => console.log(value)); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/dynamic-import-only-reexports/_expected/es/generated-chunk.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,3 @@ | ||
const value = 42; | ||
|
||
export { value }; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/dynamic-import-only-reexports/_expected/es/main.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 @@ | ||
import('./generated-chunk.js').then(({ value }) => console.log(value)); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/dynamic-import-only-reexports/_expected/system/generated-chunk.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,10 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const value = exports('value', 42); | ||
|
||
} | ||
}; | ||
}); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/dynamic-import-only-reexports/_expected/system/main.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,10 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
module.import('./generated-chunk.js').then(({ value }) => console.log(value)); | ||
|
||
} | ||
}; | ||
}); |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/dynamic-import-only-reexports/dep.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 @@ | ||
export const value = 42; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/dynamic-import-only-reexports/dynamic.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 @@ | ||
export {value} from './dep'; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/dynamic-import-only-reexports/main.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 @@ | ||
import('./dynamic').then(({ value }) => console.log(value)); |