fix(webpack): Angular no longer has issues handling {N} plugins without nativescript in name (#9172)

This commit is contained in:
Nathanael Anderson
2021-01-26 11:28:10 -06:00
committed by GitHub
parent a26b807652
commit 79a5fc8975

View File

@@ -7,18 +7,6 @@ export function getResolver(platforms: string[], explicitResolve?: string[], nsP
platformSpecificExt = platformSpecificExt || ['.ts', '.js', '.scss', '.less', '.css', '.html', '.xml', '.vue', '.json'];
return function (path: string) {
const nmIndex = path.lastIndexOf('node_modules');
if (nmIndex !== -1) {
const subPath = path.substr(nmIndex + 'node_modules'.length).replace(/\\/g, '/');
const shouldResolve = explicitResolve.length && explicitResolve.some((packageName) => subPath.indexOf(packageName) !== -1);
const pathParts = subPath.split(/[/\-_]/);
if (!shouldResolve && pathParts.every((p) => nsPackageFilters.every((f) => f !== p))) {
return path;
}
}
const { dir, name, ext } = parse(path);
if (platformSpecificExt.indexOf(ext) === -1) {