You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Requests that fall through here cannot be matched by any other externals config ahead.
1050
+
// Treat all these requests as relative import of source code. Node.js won't add the
1051
+
// leading './' to the relative path resolved by `path.relative`. So add manually it here.
1052
+
if(resolvedRequest[0]!=='.'){
1053
+
resolvedRequest=`./${resolvedRequest}`;
1054
+
}
1055
+
returnresolvedRequest;
1056
+
}
1057
+
// NOTE: If request is a phantom dependency, which means it can be resolved but not specified in dependencies or peerDependencies in package.json, the output will be incorrect to use when the package is published
1058
+
// return the original request instead of the resolved request
1059
+
returnundefined;
1060
+
}catch(e){
1061
+
// catch error when request can not be resolved by resolver
1062
+
// e.g. A react component library importing and using 'react' but while not defining
1063
+
// it in devDependencies and peerDependencies. Preserve 'react' as-is if so.
1064
+
logger.debug(
1065
+
`Failed to resolve module ${color.green(`"${request}"`)} from ${color.green(issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`,
1066
+
);
1067
+
returnrequest;
1068
+
}
1069
+
}
1070
+
1034
1071
// Issuer is not empty string when the module is imported by another module.
// only handle the request that is not in node_modules
1057
-
if(!resolvedRequest.includes('node_modules')){
1058
-
resolvedRequest=normalizeSlash(
1059
-
path.relative(
1060
-
path.dirname(contextInfo.issuer),
1061
-
resolvedRequest,
1062
-
),
1063
-
);
1064
-
// Requests that fall through here cannot be matched by any other externals config ahead.
1065
-
// Treat all these requests as relative import of source code. Node.js won't add the
1066
-
// leading './' to the relative path resolved by `path.relative`. So add manually it here.
1067
-
if(resolvedRequest[0]!=='.'){
1068
-
resolvedRequest=`./${resolvedRequest}`;
1069
-
}
1070
-
}else{
1071
-
// NOTE: If request is a phantom dependency, which means it can be resolved but not specified in dependencies or peerDependencies in package.json, the output will be incorrect to use when the package is published
1072
-
// return the original request instead of the resolved request
1073
-
returncallback(undefined,request);
1074
-
}
1075
-
}catch(e){
1076
-
// catch error when request can not be resolved by resolver
1077
-
// e.g. A react component library importing and using 'react' but while not defining
1078
-
// it in devDependencies and peerDependencies. Preserve 'react' as-is if so.
1079
-
logger.debug(
1080
-
`Failed to resolve module ${color.green(`"${resolvedRequest}"`)} from ${color.green(contextInfo.issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`,
0 commit comments