Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0
Members

Export a class

A topic by GrandSchtroumpf created May 18, 2016 Views: 405 Replies: 2
Viewing posts 1 to 3

Hi there,

I would like to use to trigger some method from a class from another one using "export". For example I would like to do:
"export class CharacterBehavior ..." and then import it in another file "import (CharacterBehavior) from './game'".
But when I do that it keeps telling me : "(0): Cannot compile modules unless the '--module' flag is provided."
Does someone know how I could achieve that ?

Thank you =)

It seems that this is a problem with tsconfig.json not defining the "module" compilerOptions. But I checked on the build version "method is defined everywhere. I don't know how the assets are compiled so I don't really know where to check.
If I compile the assets myself after publishing the project, the files don't have access to the "Sup" class. And I don't know where to import it from.

Moderator

In Superpowers, your class will be automatically accessible from any script. You don't have to import/export.