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.
1026
+
// Treat all these requests as relative import of source code. Node.js won't add the
1027
+
// leading './' to the relative path resolved by `path.relative`. So add manually it here.
1028
+
if(resolvedRequest[0]!=='.'){
1029
+
resolvedRequest=`./${resolvedRequest}`;
1030
+
}
1031
+
returnresolvedRequest;
1032
+
}
1033
+
// 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
1034
+
// return the original request instead of the resolved request
1035
+
returnundefined;
1036
+
}catch(e){
1037
+
// catch error when request can not be resolved by resolver
1038
+
// e.g. A react component library importing and using 'react' but while not defining
1039
+
// it in devDependencies and peerDependencies. Preserve 'react' as-is if so.
1040
+
logger.debug(
1041
+
`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.`,
1042
+
);
1043
+
returnrequest;
1044
+
}
1045
+
}
1046
+
1010
1047
// Issuer is not empty string when the module is imported by another module.
// only handle the request that is not in node_modules
1033
-
if(!resolvedRequest.includes('node_modules')){
1034
-
resolvedRequest=normalizeSlash(
1035
-
path.relative(
1036
-
path.dirname(contextInfo.issuer),
1037
-
resolvedRequest,
1038
-
),
1039
-
);
1040
-
// Requests that fall through here cannot be matched by any other externals config ahead.
1041
-
// Treat all these requests as relative import of source code. Node.js won't add the
1042
-
// leading './' to the relative path resolved by `path.relative`. So add manually it here.
1043
-
if(resolvedRequest[0]!=='.'){
1044
-
resolvedRequest=`./${resolvedRequest}`;
1045
-
}
1046
-
}else{
1047
-
// 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
1048
-
// return the original request instead of the resolved request
1049
-
returncallback(undefined,request);
1050
-
}
1051
-
}catch(e){
1052
-
// catch error when request can not be resolved by resolver
1053
-
// e.g. A react component library importing and using 'react' but while not defining
1054
-
// it in devDependencies and peerDependencies. Preserve 'react' as-is if so.
1055
-
logger.debug(
1056
-
`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