PhaserEditor2D / PhaserEditor

A friendly IDE to develop HTML5 games based on the Phaser framework.
https://phasereditor2d.com
Eclipse Public License 1.0
327 stars 45 forks source link

A new solution for issue #67: Uncaught ReferenceError: exports is not defined #70

Open codingisnothingtodo opened 6 years ago

codingisnothingtodo commented 6 years ago

I think I've got an exact solution for modularity problem of Typescript projects. I wrote a Java class that includes imported, extended and dependency classes into Level.js file. But user must define its class hierarchy in an XML file. So I think you may want to look and discuss about this. If you like my code you may want to develop more accurate version and integrate it to your new product. Because according to my research I understand that Typescript has some modularity problems because of compiling into Javascript and Javascript whose version is older than Ecma 2015 doesn't support modules natively Except it may work correctly in its native IDE, Visual Studio that I haven't tried it. moduleTrial.zip shapeControllerBuild.zip

PhaserEditor2D commented 6 years ago

Hi, right now I am very busy with the coming v1.5.0 release, after this release, I should do a huge re-write of the editor to support phaser v3 and other new stuff I have in mind. I will look to this issue then. Probably this could be added via a third-party plugin.

PhaserEditor2D commented 6 years ago

By the way, did you try by compiling all TS files into a single JS file? The TypeScript compiler has that option.

codingisnothingtodo commented 6 years ago

Yes Arian I tried it. But there was so many errors. And also I used the option at tsconfig.json.

2018-02-13 1:06 GMT+03:00 Phaser Editor notifications@github.com:

By the way, did you try by compiling all TS files into a single JS file? The TypeScript compiler has that option.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PhaserEditor2D/PhaserEditor/issues/70#issuecomment-365078951, or mute the thread https://github.com/notifications/unsubscribe-auth/AQiCk5Y-VzBQIWX562Pi-BqTLSvB8Bz_ks5tULXdgaJpZM4R1VVt .

bfountaine commented 5 years ago

I've got a much simpler solution to this. If I understand you correctly what you want to do is:

export class MyClass { // class properties and methods here. }

so that in another class file you can go

import {MyClass } from "./MyClass";

export class MyOtherClass extends MyClass {

}

what you can do instead is put the export statement on the bottom line eg:

class MyClass { // class properties and methods here. } export { MyClass }

then your 2nd class can be the same as above.