Code that compiles fails to package

I have a project that is also made up of plugins. It compiles fine for the editor and everything runs.

But oddly enough when I package it, it always fails with error messages like this in the output log:

error C2504: ‘AActor’: base class undefined

I tried manually including AActor and then this error goes away, but my output log is just completely full of these errors so I have to keep including weird things like TimerManager or Engine/Engine.h to access GEngine and other things.

I’m trying to follow the Include What you Use guide to avoid just including Engine.h like we used to: https://docs.unrealengine.com/latest…eferenceGuide/

I don’t really get how the editor can compile just fine but not the packaged game.