Issue packaging C++ Plugin for Windows

Hi,

I’m currently building a C++ plugin which builds successfully through Visual Studio and the contained components work fine during testing. However, when I attempt to package the plugin, I’m getting numerous compilation errors which don’t occur during normal builds. I can even package the entire project for Windows/Android without issue.

All of the errors are along the lines of the one below:

error: cannot initialize object parameter of type 'const USceneComponent' with an expression of type 'UVRGrabComponentBase'
UPrimitiveComponent* ParentComp = Cast<UPrimitiveComponent>(GetAttachParent());

In the case of the one above, the UVRGrabComponentBase inherits from USceneComponent and #include "Components/SceneComponent.h" is in its header file.

There is also other errors such as this one which is given even with an otherwise blank class as generated by Unreal itself.

error: cannot initialize object parameter of type 'UActorComponent' with an expression of type 'UVRGrabComponentBase'
Super::BeginPlay();

Below is my .uplugin configuration:

{
	"FileVersion": 3,
	"Version": 1,
	"VersionName": "1.0",
	"FriendlyName": "VRTemplatePlugin",
	"Description": "",
	"Category": "Other",
	"CreatedBy": "",
	"CreatedByURL": "",
	"DocsURL": "",
	"MarketplaceURL": "",
	"SupportURL": "",
	"CanContainContent": true,
	"IsBetaVersion": false,
	"IsExperimentalVersion": false,
	"Installed": false,
	"SupportedTargetPlatforms": [
		"Win64",
		"Android",
	],
	"Modules": [
		{
			"Name": "VRTemplatePlugin",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		}
	]
}

And finally the Build.cs for the plugin:

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class VRTemplatePlugin : ModuleRules
{
	public VRTemplatePlugin(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
		
		PublicIncludePaths.AddRange(
			new string[] {
				// ... add public include paths required here ...
			}
			);
				
		
		PrivateIncludePaths.AddRange(
			new string[] {
				// ... add other private include paths required here ...
			}
			);
			
		
		PublicDependencyModuleNames.AddRange(
			new string[]
			{
                "Core", "CoreUObject", "Engine", "InputCore", "PhysicsCore", "Chaos", "Niagara", "UMG"
            }
			);
			
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"CoreUObject",
				"Engine",
				"Slate",
				"SlateCore",
                "HeadMountedDisplay"
				// ... add private dependencies that you statically link with here ...	
			}
			);
		
		
		DynamicallyLoadedModuleNames.AddRange(
			new string[]
			{
				// ... add any modules that your module loads dynamically here ...
			}
			);
	}
}

Any help with this would be greatly appreciated!