What should we name the module build of PlayCanvas? #2661
Replies: 2 comments 1 reply
-
I've noticed as well lack of popularity on mjs file extension. If js file is loaded not as module but with export, it will complain. So it is sensible to have There is basically two paths we can go:
What is done behind the scene in Editor and publish is perhaps less relevant here. I'm personally more inclined to modern version by default, and provide mechanism to properly notify if running on older platform. With good developer docs on this topic, for ES5 engine usage and hybrid solution. |
Beta Was this translation helpful? Give feedback.
-
Since It is also quite easy to remember... "just put on
And then maybe a little example in <script type="module">
import * as pc from "https://code.playcanvas.com/playcanvas-stable.min.es6.js";
window.pc = pc;
// create a PlayCanvas application
const canvas = document.getElementById('application');
const app = new pc.Application(canvas);
// ... |
Beta Was this translation helpful? Give feedback.
-
The Rollup build process now outputs
playcanvas.js
(ES5 UMD library) andplaycanvas.mjs
(ES6 module).I just tried to convert a PlayCanvas engine example to use the module instead of the ES5 version. The example failed to load saying the
playcanvas.mjs
module was being served with MIME type "". So a default Apache install doesn't specify a MIME type formjs
files basically. Which kind of sucks, because.mjs
seems fairly well accepted as the extension for JS modules.To fix it, I had to edit my
httpd.conf
file to have:But I think it's probably unrealistic for developers to have to go and edit their web server configs to get started with PlayCanvas.
We could have:
Or:
I kind of like at least one build (ideally the recommended/best one being named just
playcanvas.js
. But, yeah, we could also be explicit everywhere and have:Or even:
Does anybody else have any thoughts/ideas/preferences about this?
Beta Was this translation helpful? Give feedback.
All reactions