MCPcopy
hub / github.com/webpack/webpack / _resolveResourceErrorHints

Method _resolveResourceErrorHints

lib/NormalModuleFactory.js:1198–1311  ·  lib/NormalModuleFactory.js::NormalModuleFactory._resolveResourceErrorHints

* 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
	)

Source from the content-addressed store, hash-verified

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}'?
1229BREAKING 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"').
1231The extension in the request is mandatory for it to be fully specified.
1232Add 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) {

Callers 1

resolveResourceMethod · 0.95

Calls 7

execMethod · 0.80
isArrayMethod · 0.80
resolveMethod · 0.65
callbackFunction · 0.50
replaceMethod · 0.45
hasMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected