* Resolve resource error hints. * @param {Error} error error * @param {ModuleFactoryCreateDataContextInfo} contextInfo context info * @param {string} context context * @param {string} unresolvedResource unresolved resource * @param {ResolverWithOptions} resolver resolver * @param {Resolv
( error, contextInfo, context, unresolvedResource, resolver, resolveContext, callback )
| 1196 | * @private |
| 1197 | */ |
| 1198 | _resolveResourceErrorHints( |
| 1199 | error, |
| 1200 | contextInfo, |
| 1201 | context, |
| 1202 | unresolvedResource, |
| 1203 | resolver, |
| 1204 | resolveContext, |
| 1205 | callback |
| 1206 | ) { |
| 1207 | asyncLib.parallel( |
| 1208 | [ |
| 1209 | (callback) => { |
| 1210 | if (!resolver.options.fullySpecified) return callback(); |
| 1211 | resolver |
| 1212 | .withOptions({ |
| 1213 | fullySpecified: false |
| 1214 | }) |
| 1215 | .resolve( |
| 1216 | contextInfo, |
| 1217 | context, |
| 1218 | unresolvedResource, |
| 1219 | resolveContext, |
| 1220 | (err, resolvedResource) => { |
| 1221 | if (!err && resolvedResource) { |
| 1222 | const resource = parseResource(resolvedResource).path.replace( |
| 1223 | /^.*[\\/]/, |
| 1224 | class="st">"" |
| 1225 | ); |
| 1226 | return callback( |
| 1227 | null, |
| 1228 | `Did you mean class="st">'${resource}'? |
| 1229 | BREAKING CHANGE: The request class="st">'${unresolvedResource}' failed to resolve only because it was resolved as fully specified |
| 1230 | (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a class="st">'*.mjs' file, or a class="st">'*.js' file where the package.json contains class="st">'"type": "module"'). |
| 1231 | The extension in the request is mandatory for it to be fully specified. |
| 1232 | Add the extension to the request.` |
| 1233 | ); |
| 1234 | } |
| 1235 | callback(); |
| 1236 | } |
| 1237 | ); |
| 1238 | }, |
| 1239 | (callback) => { |
| 1240 | if (!resolver.options.enforceExtension) return callback(); |
| 1241 | resolver |
| 1242 | .withOptions({ |
| 1243 | enforceExtension: false, |
| 1244 | extensions: [] |
| 1245 | }) |
| 1246 | .resolve( |
| 1247 | contextInfo, |
| 1248 | context, |
| 1249 | unresolvedResource, |
| 1250 | resolveContext, |
| 1251 | (err, resolvedResource) => { |
| 1252 | if (!err && resolvedResource) { |
| 1253 | let hint = class="st">""; |
| 1254 | const match = /\.[^.]+(?:\?|$)/.exec(unresolvedResource); |
| 1255 | if (match) { |