@@ -233,7 +233,8 @@ exports[`plugin Magic comment should transpile shortand properties 1`] = `
233
233
` ;
234
234
235
235
exports [` plugin aggressive import should work with destructuration 1` ] = `
236
- "loadable({
236
+ "import loadable from '@loadable/component';
237
+ loadable({
237
238
resolved : {},
238
239
239
240
chunkName ({
@@ -295,7 +296,8 @@ exports[`plugin aggressive import should work with destructuration 1`] = `
295
296
` ;
296
297
297
298
exports [` plugin aggressive import with "webpackChunkName" should keep it 1` ] = `
298
- "loadable({
299
+ "import loadable from '@loadable/component';
300
+ loadable({
299
301
resolved : {},
300
302
301
303
chunkName (props ) {
@@ -351,7 +353,8 @@ exports[`plugin aggressive import with "webpackChunkName" should keep it 1`] = `
351
353
` ;
352
354
353
355
exports [` plugin aggressive import with "webpackChunkName" should replace it 1` ] = `
354
- "loadable({
356
+ "import loadable from '@loadable/component';
357
+ loadable({
355
358
resolved : {},
356
359
357
360
chunkName (props ) {
@@ -407,7 +410,8 @@ exports[`plugin aggressive import with "webpackChunkName" should replace it 1`]
407
410
` ;
408
411
409
412
exports [` plugin aggressive import without "webpackChunkName" should support complex request 1` ] = `
410
- "loadable({
413
+ "import loadable from '@loadable/component';
414
+ loadable({
411
415
resolved : {},
412
416
413
417
chunkName (props ) {
@@ -463,7 +467,8 @@ exports[`plugin aggressive import without "webpackChunkName" should support comp
463
467
` ;
464
468
465
469
exports [` plugin aggressive import without "webpackChunkName" should support destructuring 1` ] = `
466
- "loadable({
470
+ "import loadable from '@loadable/component';
471
+ loadable({
467
472
resolved : {},
468
473
469
474
chunkName ({
@@ -525,7 +530,8 @@ exports[`plugin aggressive import without "webpackChunkName" should support dest
525
530
` ;
526
531
527
532
exports [` plugin aggressive import without "webpackChunkName" should support simple request 1` ] = `
528
- "loadable({
533
+ "import loadable from '@loadable/component';
534
+ loadable({
529
535
resolved : {},
530
536
531
537
chunkName (props ) {
@@ -581,7 +587,8 @@ exports[`plugin aggressive import without "webpackChunkName" should support simp
581
587
` ;
582
588
583
589
exports [` plugin loadable.lib should be transpiled too 1` ] = `
584
- "loadable.lib({
590
+ "import loadable from '@loadable/component';
591
+ loadable.lib({
585
592
resolved : {},
586
593
587
594
chunkName () {
@@ -637,7 +644,8 @@ exports[`plugin loadable.lib should be transpiled too 1`] = `
637
644
` ;
638
645
639
646
exports [` plugin simple import in a complex promise should work 1` ] = `
640
- "loadable({
647
+ "import loadable from '@loadable/component';
648
+ loadable({
641
649
resolved : {},
642
650
643
651
chunkName () {
@@ -692,8 +700,14 @@ exports[`plugin simple import in a complex promise should work 1`] = `
692
700
} );"
693
701
` ;
694
702
703
+ exports [` plugin simple import should not work with renamed specifier by default 1` ] = `
704
+ "import renamedLoadable from '@loadable/component';
705
+ renamedLoadable(() => import(\` ./ModA\` ));"
706
+ ` ;
707
+
695
708
exports [` plugin simple import should transform path into "chunk-friendly" name 1` ] = `
696
- "loadable({
709
+ "import loadable from '@loadable/component';
710
+ loadable({
697
711
resolved : {},
698
712
699
713
chunkName () {
@@ -749,7 +763,8 @@ exports[`plugin simple import should transform path into "chunk-friendly" name 1
749
763
` ;
750
764
751
765
exports [` plugin simple import should work with * in name 1` ] = `
752
- "loadable({
766
+ "import loadable from '@loadable/component';
767
+ loadable({
753
768
resolved : {},
754
769
755
770
chunkName () {
@@ -805,7 +820,8 @@ exports[`plugin simple import should work with * in name 1`] = `
805
820
` ;
806
821
807
822
exports [` plugin simple import should work with + concatenation 1` ] = `
808
- "loadable({
823
+ "import loadable from '@loadable/component';
824
+ loadable({
809
825
resolved : {},
810
826
811
827
chunkName () {
@@ -917,8 +933,66 @@ lazy({
917
933
});"
918
934
` ;
919
935
936
+ exports [` plugin simple import should work with renamed lazy specifier 1` ] = `
937
+ "import { lazy as renamedLazy } from '@loadable/component';
938
+ renamedLazy({
939
+ resolved : {},
940
+
941
+ chunkName () {
942
+ return \`ModA\`.replace(/[^a -zA -Z0 -9_ !§$ ()= \\\\- ^ °]+/g , \\"-\\");
943
+ },
944
+
945
+ isReady (props ) {
946
+ const key = this.resolve(props );
947
+
948
+ if (this .resolved [key ] !== true ) {
949
+ return false ;
950
+ }
951
+
952
+ if (typeof __webpack_modules__ !== 'undefined ') {
953
+ return !! __webpack_modules__ [key ];
954
+ }
955
+
956
+ return false;
957
+ },
958
+
959
+ importAsync : () => import (
960
+ /* webpackChunkName: \\"ModA\\" */
961
+ \` ./ModA\` ),
962
+
963
+ requireAsync(props) {
964
+ const key = this .resolve (props );
965
+ this .resolved [key ] = false ;
966
+ return this .importAsync (props ).then (resolved => {
967
+ this .resolved [key ] = true ;
968
+ return resolved ;
969
+ });
970
+ } ,
971
+
972
+ requireSync(props) {
973
+ const id = this .resolve (props );
974
+
975
+ if (typeof __webpack_require__ !== ' undefined' ) {
976
+ return __webpack_require__(id );
977
+ }
978
+
979
+ return eval (' module.require' )(id );
980
+ } ,
981
+
982
+ resolve() {
983
+ if (require .resolveWeak ) {
984
+ return require.resolveWeak(\`./ModA \`);
985
+ }
986
+
987
+ return eval (' require.resolve' )(\` ./ModA\` );
988
+ }
989
+
990
+ });"
991
+ ` ;
992
+
920
993
exports [` plugin simple import should work with template literal 1` ] = `
921
- "loadable({
994
+ "import loadable from '@loadable/component';
995
+ loadable({
922
996
resolved : {},
923
997
924
998
chunkName () {
@@ -974,7 +1048,8 @@ exports[`plugin simple import should work with template literal 1`] = `
974
1048
` ;
975
1049
976
1050
exports [` plugin simple import with "webpackChunkName" comment should use it 1` ] = `
977
- "loadable({
1051
+ "import loadable from '@loadable/component';
1052
+ loadable({
978
1053
resolved : {},
979
1054
980
1055
chunkName () {
@@ -1030,7 +1105,8 @@ exports[`plugin simple import with "webpackChunkName" comment should use it 1`]
1030
1105
` ;
1031
1106
1032
1107
exports [` plugin simple import with "webpackChunkName" comment should use it even if comment is separated by "," 1` ] = `
1033
- "loadable({
1108
+ "import loadable from '@loadable/component';
1109
+ loadable({
1034
1110
resolved : {},
1035
1111
1036
1112
chunkName () {
@@ -1086,7 +1162,8 @@ exports[`plugin simple import with "webpackChunkName" comment should use it even
1086
1162
` ;
1087
1163
1088
1164
exports [` plugin simple import without "webpackChunkName" comment should add it 1` ] = `
1089
- "loadable({
1165
+ "import loadable from '@loadable/component';
1166
+ loadable({
1090
1167
resolved : {},
1091
1168
1092
1169
chunkName () {
0 commit comments