@@ -1137,6 +1137,16 @@ func TestUndefinedImportWarningCSS(t *testing.T) {
1137
1137
import * as empty_css from './empty.css'
1138
1138
import * as empty_global_css from './empty.global-css'
1139
1139
import * as empty_local_css from './empty.local-css'
1140
+
1141
+ import * as pkg_empty_js from 'pkg/empty.js'
1142
+ import * as pkg_empty_esm_js from 'pkg/empty.esm.js'
1143
+ import * as pkg_empty_json from 'pkg/empty.json'
1144
+ import * as pkg_empty_css from 'pkg/empty.css'
1145
+ import * as pkg_empty_global_css from 'pkg/empty.global-css'
1146
+ import * as pkg_empty_local_css from 'pkg/empty.local-css'
1147
+
1148
+ import 'pkg'
1149
+
1140
1150
console.log(
1141
1151
empty_js.foo,
1142
1152
empty_esm_js.foo,
@@ -1145,13 +1155,49 @@ func TestUndefinedImportWarningCSS(t *testing.T) {
1145
1155
empty_global_css.foo,
1146
1156
empty_local_css.foo,
1147
1157
)
1158
+
1159
+ console.log(
1160
+ pkg_empty_js.foo,
1161
+ pkg_empty_esm_js.foo,
1162
+ pkg_empty_json.foo,
1163
+ pkg_empty_css.foo,
1164
+ pkg_empty_global_css.foo,
1165
+ pkg_empty_local_css.foo,
1166
+ )
1148
1167
` ,
1168
+
1149
1169
"/empty.js" : `` ,
1150
1170
"/empty.esm.js" : `export {}` ,
1151
1171
"/empty.json" : `{}` ,
1152
1172
"/empty.css" : `` ,
1153
1173
"/empty.global-css" : `` ,
1154
1174
"/empty.local-css" : `` ,
1175
+
1176
+ "/node_modules/pkg/empty.js" : `` ,
1177
+ "/node_modules/pkg/empty.esm.js" : `export {}` ,
1178
+ "/node_modules/pkg/empty.json" : `{}` ,
1179
+ "/node_modules/pkg/empty.css" : `` ,
1180
+ "/node_modules/pkg/empty.global-css" : `` ,
1181
+ "/node_modules/pkg/empty.local-css" : `` ,
1182
+
1183
+ // Files inside of "node_modules" should not generate a warning
1184
+ "/node_modules/pkg/index.js" : `
1185
+ import * as empty_js from './empty.js'
1186
+ import * as empty_esm_js from './empty.esm.js'
1187
+ import * as empty_json from './empty.json'
1188
+ import * as empty_css from './empty.css'
1189
+ import * as empty_global_css from './empty.global-css'
1190
+ import * as empty_local_css from './empty.local-css'
1191
+
1192
+ console.log(
1193
+ empty_js.foo,
1194
+ empty_esm_js.foo,
1195
+ empty_json.foo,
1196
+ empty_css.foo,
1197
+ empty_global_css.foo,
1198
+ empty_local_css.foo,
1199
+ )
1200
+ ` ,
1155
1201
},
1156
1202
entryPaths : []string {"/entry.js" },
1157
1203
options : config.Options {
@@ -1171,6 +1217,12 @@ entry.js: WARNING: Import "foo" will always be undefined because there is no mat
1171
1217
entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "empty.css"
1172
1218
entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "empty.global-css"
1173
1219
entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "empty.local-css"
1220
+ entry.js: WARNING: Import "foo" will always be undefined because the file "node_modules/pkg/empty.js" has no exports
1221
+ entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "node_modules/pkg/empty.esm.js"
1222
+ entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "node_modules/pkg/empty.json"
1223
+ entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "node_modules/pkg/empty.css"
1224
+ entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "node_modules/pkg/empty.global-css"
1225
+ entry.js: WARNING: Import "foo" will always be undefined because there is no matching export in "node_modules/pkg/empty.local-css"
1174
1226
` ,
1175
1227
})
1176
1228
}
0 commit comments