fix(webpack): exclude other platforms from require.context (#9686)

fixes #9682
This commit is contained in:
Igor Randjelovic
2022-02-18 13:37:32 +01:00
committed by GitHub
parent 1601caff4e
commit cb7bd2a401
9 changed files with 86 additions and 2 deletions

View File

@ -40,6 +40,13 @@ export function getPlatform(): INativeScriptPlatform {
return platforms[getPlatformName()];
}
/**
* Utility to get all registered/available platforms
*/
export function getAvailablePlatforms(): string[] {
return Object.keys(platforms);
}
/**
* Utility to get the currently targeted platform name
*/
@ -61,7 +68,7 @@ export function getPlatformName(): Platform {
throw error(`
Invalid platform: ${env.platform}
Valid platforms: ${Object.keys(platforms).join(', ')}
Valid platforms: ${getAvailablePlatforms().join(', ')}
`);
}