Migrate to ES6 modules?

Hello,

I know that they’re not implemented natively yet, but due to the fact that PM already using Babel, can we consider to migrate from AMD to ES6 modules?

I just migrated the other way – 0.7.0 uses ES6 modules, but 0.8.0 will be CommonJS, because it means we can run the code without compilation step on modern platforms, which greatly streamlines development. Once browsers implement <script type=module>, I’ll change back.

1 Like

As long as you change back once they start being available natively, it’s ok for FW.

I had previously mildly protested this switch because for me it means that I have to explain to developers who are new to JavaScript modules (and to remember myself) how two different import/module systems work. Even though there doesn’t seem to be any difficulty combining our ES6 modules with CommonJS modules in PM as long as everything is transpiled, I generally end up having to study PM code quite a bit.

But I can see that it is a major advantage for your development setup, and it’s not that big a deal for us at least. I just hope the day of ES6 module support in browsers comes sooner rather than later.

1 Like