@@ -40,6 +40,11 @@ const plugin = (options = {}) => {
40
40
...new Set ( [ normalizedUrl , request ] ) ,
41
41
] ) ;
42
42
43
+ if ( ! resolvedUrl ) {
44
+ return ;
45
+ }
46
+
47
+ // eslint-disable-next-line consistent-return
43
48
return { url : resolvedUrl , prefix, tokens } ;
44
49
} ;
45
50
@@ -49,8 +54,14 @@ const plugin = (options = {}) => {
49
54
const results = await Promise . all ( tasks ) ;
50
55
51
56
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 ;
54
65
const importKey = newUrl ;
55
66
let importName = imports . get ( importKey ) ;
56
67
@@ -68,9 +79,11 @@ const plugin = (options = {}) => {
68
79
options . api . push ( { importName, dedupe : true , index } ) ;
69
80
}
70
81
71
- for ( const [ replacementIndex , token ] of Object . keys ( tokens ) . entries ( ) ) {
82
+ for ( const [ replacementIndex , token ] of Object . keys (
83
+ item . tokens
84
+ ) . entries ( ) ) {
72
85
const replacementName = `___CSS_LOADER_ICSS_IMPORT_${ index } _REPLACEMENT_${ replacementIndex } ___` ;
73
- const localName = tokens [ token ] ;
86
+ const localName = item . tokens [ token ] ;
74
87
75
88
importReplacements [ token ] = replacementName ;
76
89
0 commit comments