Angular script compilation: TypeError: Class constructor MyScript cannot be invoked without 'new'

Hi @jim-decocq !

I have tried multiple ideas and I need to review (with breaking changes for sure) the way to attach scripts in the Editor to support ES6 JavaScript classes.

Also I have found tons of answers like this one (node.js - Class constructor cannot be invoked without 'new' - typescript with commonjs - Stack Overflow) which provides links to the official spec for ES6 modules: constructors must be call with “new” keyword

My questions are:

  • Do you use the tsconfig.json file generated by the Editor template to transpile your Angular files?
  • Are you using pure JS when developing your Angular App ?
  • In other words, are your angular app and the editor project merged into only one project ? I mean sharing the same tsconfig.json file, same webpack config etc.

I have tried to instantiate a game (the class named “Game”) from an ES6 class where all the editor’s files (scripts, tools, etc.) were transpiled into ES5. Is there a way in your project to distinguish the angular app compilation stage and the one from the editor ? This would allow to avoid rewriting your angular app