Hi! I’m using PlayCanvas sync to build my game in TypeScript and have it transpile over to Javascript. I’m not particularly knowledgeable in TS, but I do greatly enjoy using it over Javascript.
One strange (to me) issue I’m encountering is that whenever my script requires an import
call, the script is no longer found after a reparse in the PlayCanvas editor. So given the following TypeScript code:
class WorkingScript extends pc.ScriptType
{
initialize()
{
}
}
pc.registerScript(WorkingScript)
import pc from "playcanvas";
class NonWorkingScript extends pc.ScriptType
{
initialize()
{
}
}
pc.registerScript(NonWorkingScript)
NonWorkingScript
will not be found by PlayCanvas, while WorkingScript
will. No errors.
The Javascript exports of the scripts can be found here, which I’m sure clearly show the issue, but I can’t identify it.
What can I do to be able to use the import
keyword (which I need in order to import some other scripts in my actual project) for ScriptType
derivatives in my TypeScript files without harming their ability to be found by the editor?
Thanks!