@@ -40,6 +40,11 @@ const plugin = (options = {}) => {
4040 ...new Set ( [ normalizedUrl , request ] ) ,
4141 ] ) ;
4242
43+ if ( ! resolvedUrl ) {
44+ return ;
45+ }
46+
47+ // eslint-disable-next-line consistent-return
4348 return { url : resolvedUrl , prefix, tokens } ;
4449 } ;
4550
@@ -49,8 +54,14 @@ const plugin = (options = {}) => {
4954 const results = await Promise . all ( tasks ) ;
5055
5156 for ( let index = 0 ; index <= results . length - 1 ; index ++ ) {
52- const { url, prefix, tokens } = results [ index ] ;
53- const newUrl = prefix ? `${ prefix } !${ url } ` : url ;
57+ const item = results [ index ] ;
58+
59+ if ( ! item ) {
60+ // eslint-disable-next-line no-continue
61+ continue ;
62+ }
63+
64+ const newUrl = item . prefix ? `${ item . prefix } !${ item . url } ` : item . url ;
5465 const importKey = newUrl ;
5566 let importName = imports . get ( importKey ) ;
5667
@@ -68,9 +79,11 @@ const plugin = (options = {}) => {
6879 options . api . push ( { importName, dedupe : true , index } ) ;
6980 }
7081
71- for ( const [ replacementIndex , token ] of Object . keys ( tokens ) . entries ( ) ) {
82+ for ( const [ replacementIndex , token ] of Object . keys (
83+ item . tokens
84+ ) . entries ( ) ) {
7285 const replacementName = `___CSS_LOADER_ICSS_IMPORT_${ index } _REPLACEMENT_${ replacementIndex } ___` ;
73- const localName = tokens [ token ] ;
86+ const localName = item . tokens [ token ] ;
7487
7588 importReplacements [ token ] = replacementName ;
7689
0 commit comments