AidasPa / uts

UnrealJS + TypeScript Toolkit

Home Page:https://www.npmjs.com/package/@aidaspa/uts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exports is not defined

johnathandinh opened this issue · comments

ReferenceError: exports is not defined

I'm getting this error when generating a Actor class. It goes away if I pass BlueprintComponent into the @UCLASS decorator. If I compare the compiled JS files between the a BPComponent and non BPComponent, the non BPComponent has additional lines that define the exports property as default.

commented

you cannot export anything from a file that you will be loading via the editor - which in a way makes no sense anyways since you can't import anything apart from the whole file via the blueprint. The BlueprintComponent argument takes care of this by, if specified, removing the export.

So for example, you have MyCharacter and InheritedCharacter classes.
InheritedCharacter extends MyCharacter. So you export default MyCharacter and import MyCharacter from "./MyCharacter.u";
it in your InheritedCharacter. In order to then load InheritedCharacter from the editor, you need to specifiy InheritedCharacter as a BlueprintComponent in the decorator.

Hope this clears it up a little bit.

If you're still confused, which I would not be surprised because I don't think I did a very good job documenting this, please post some code samples