mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(webpack): exclude other platforms from require.context (#9686)
fixes #9682
This commit is contained in:
@ -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(', ')}
|
||||
`);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user