Engine has been ported to ES6 Modules: HELP US TEST!

Hi everyone,

Last week, the engine was ported from ES5 to ES6 Module format. It was a huge refactor of the PlayCanvas codebase, but it’s really exciting because it will help us move the engine forwards. Read all about the effort here:

Here’s where you come in. To ensure we have a smooth roll-out, you can help us test it and catch any potential bugs. To do so, just launch your scene from the Editor and add the following to the URL:

?use_local_engine=https://code.playcanvas.com/playcanvas-latest.dbg.js

So you should have something of the form:

https://launch.playcanvas.com/404993?use_local_engine=https://code.playcanvas.com/playcanvas-latest.dbg.js

Please follow up with any change of behavior. Thanks! :smile:

8 Likes

Great !!! I wil do just now… !!

1 Like

everything ok… no problems at all !! thanks

1 Like

Great news! Looks good in my projects :+1:

I’m sorry @LeXXik and @Diego_Lopez-Mobilia. It seems the engine hasn’t been deploying correctly. We’re fixing it now. I’ll let you know when it’s actually there. Once again, my apologies.

2 Likes

OK, the dev engine is now the correct version, build with Rollup from ES6 modules. Please try again. :smile:

Not ready to support typescript, this is more fragrant. :laughing: :laughing: :laughing: :laughing:

@zhou_xia Well, this is maybe a step towards Typescript. :smile: We now have import/export statements and a nice build system which integrates nicely with the Typescript compiler. We haven’t 100% decided whether we’ll choose Typescript over ES6+Babel, but I think Typescript currently is the preference.

2 Likes

It would be great if we get some love for the code editor, in the Playcanvas editor, as well :innocent:

Currently even with the ES6 flag, async/await for example isn’t supported and throws so many syntax errors and warnings.

1 Like

I don’t know exactly what to look for, but most projects seem to be working fine.

The only error I encounter is the project in which we use Firebase:

Uncaught SyntaxError: Identifier 'database' has already been declared

The string database only appears in the engine’s comments. So I suspect that doesn’t have anything to do with the PlayCanvas engine.

Yes, you are right. It’s because of a temporary script that I recently added for later use. Sorry, my bad.

everything working fine !!: thanks

1 Like

By default use ES6 in scripts? No need use for ES6 anymore?

/*jshint esversion: 6, asi: true, laxbreak: true*/

The engine has been ported to ES6 but the Editor is still expecting ES5 so you will still need the jshint comment.

I think we should remove that warning for ES6 scripts in the Code Editor now. @yaustar, maybe add an issue on the Editor repo to remove this?

Done! https://github.com/playcanvas/editor/issues/112

3 Likes

Does this mean that we can now use ES6 in our scripts? And the engine will still transpile it to ES5 so it is still running properly on IE11 for example?

No. It means that the code editor will no longer warn you about the presence of ES6 in you scripts, and it will be up to you to run your __game-scripts.js file through Babel or Buble (by downloading your game as a ZIP from playcanvas.com).

However, I did just add the following suggestion to @syau’s issue on GitHub:

Perhaps as an intermediate step, we should make this an user preference that defaults to off.

1 Like