@@ -233,7 +233,8 @@ exports[`plugin Magic comment should transpile shortand properties 1`] = `
233233` ;
234234
235235exports [` plugin aggressive import should work with destructuration 1` ] = `
236- "loadable({
236+ "import loadable from '@loadable/component';
237+ loadable({
237238 resolved : {},
238239
239240 chunkName ({
@@ -295,7 +296,8 @@ exports[`plugin aggressive import should work with destructuration 1`] = `
295296` ;
296297
297298exports [` plugin aggressive import with "webpackChunkName" should keep it 1` ] = `
298- "loadable({
299+ "import loadable from '@loadable/component';
300+ loadable({
299301 resolved : {},
300302
301303 chunkName (props ) {
@@ -351,7 +353,8 @@ exports[`plugin aggressive import with "webpackChunkName" should keep it 1`] = `
351353` ;
352354
353355exports [` plugin aggressive import with "webpackChunkName" should replace it 1` ] = `
354- "loadable({
356+ "import loadable from '@loadable/component';
357+ loadable({
355358 resolved : {},
356359
357360 chunkName (props ) {
@@ -407,7 +410,8 @@ exports[`plugin aggressive import with "webpackChunkName" should replace it 1`]
407410` ;
408411
409412exports [` plugin aggressive import without "webpackChunkName" should support complex request 1` ] = `
410- "loadable({
413+ "import loadable from '@loadable/component';
414+ loadable({
411415 resolved : {},
412416
413417 chunkName (props ) {
@@ -463,7 +467,8 @@ exports[`plugin aggressive import without "webpackChunkName" should support comp
463467` ;
464468
465469exports [` plugin aggressive import without "webpackChunkName" should support destructuring 1` ] = `
466- "loadable({
470+ "import loadable from '@loadable/component';
471+ loadable({
467472 resolved : {},
468473
469474 chunkName ({
@@ -525,7 +530,8 @@ exports[`plugin aggressive import without "webpackChunkName" should support dest
525530` ;
526531
527532exports [` plugin aggressive import without "webpackChunkName" should support simple request 1` ] = `
528- "loadable({
533+ "import loadable from '@loadable/component';
534+ loadable({
529535 resolved : {},
530536
531537 chunkName (props ) {
@@ -581,7 +587,8 @@ exports[`plugin aggressive import without "webpackChunkName" should support simp
581587` ;
582588
583589exports [` plugin loadable.lib should be transpiled too 1` ] = `
584- "loadable.lib({
590+ "import loadable from '@loadable/component';
591+ loadable.lib({
585592 resolved : {},
586593
587594 chunkName () {
@@ -637,7 +644,8 @@ exports[`plugin loadable.lib should be transpiled too 1`] = `
637644` ;
638645
639646exports [` plugin simple import in a complex promise should work 1` ] = `
640- "loadable({
647+ "import loadable from '@loadable/component';
648+ loadable({
641649 resolved : {},
642650
643651 chunkName () {
@@ -692,8 +700,14 @@ exports[`plugin simple import in a complex promise should work 1`] = `
692700} );"
693701` ;
694702
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+
695708exports [` plugin simple import should transform path into "chunk-friendly" name 1` ] = `
696- "loadable({
709+ "import loadable from '@loadable/component';
710+ loadable({
697711 resolved : {},
698712
699713 chunkName () {
@@ -749,7 +763,8 @@ exports[`plugin simple import should transform path into "chunk-friendly" name 1
749763` ;
750764
751765exports [` plugin simple import should work with * in name 1` ] = `
752- "loadable({
766+ "import loadable from '@loadable/component';
767+ loadable({
753768 resolved : {},
754769
755770 chunkName () {
@@ -805,7 +820,8 @@ exports[`plugin simple import should work with * in name 1`] = `
805820` ;
806821
807822exports [` plugin simple import should work with + concatenation 1` ] = `
808- "loadable({
823+ "import loadable from '@loadable/component';
824+ loadable({
809825 resolved : {},
810826
811827 chunkName () {
@@ -917,8 +933,66 @@ lazy({
917933});"
918934` ;
919935
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+
920993exports [` plugin simple import should work with template literal 1` ] = `
921- "loadable({
994+ "import loadable from '@loadable/component';
995+ loadable({
922996 resolved : {},
923997
924998 chunkName () {
@@ -974,7 +1048,8 @@ exports[`plugin simple import should work with template literal 1`] = `
9741048` ;
9751049
9761050exports [` plugin simple import with "webpackChunkName" comment should use it 1` ] = `
977- "loadable({
1051+ "import loadable from '@loadable/component';
1052+ loadable({
9781053 resolved : {},
9791054
9801055 chunkName () {
@@ -1030,7 +1105,8 @@ exports[`plugin simple import with "webpackChunkName" comment should use it 1`]
10301105` ;
10311106
10321107exports [` 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({
10341110 resolved : {},
10351111
10361112 chunkName () {
@@ -1086,7 +1162,8 @@ exports[`plugin simple import with "webpackChunkName" comment should use it even
10861162` ;
10871163
10881164exports [` plugin simple import without "webpackChunkName" comment should add it 1` ] = `
1089- "loadable({
1165+ "import loadable from '@loadable/component';
1166+ loadable({
10901167 resolved : {},
10911168
10921169 chunkName () {
0 commit comments