Ship stdlib es6 format in .mjs extension

Note we are going to land a PR which allows user to customize its file extension:

With this customization, so we don’t need fight which one is better, so user can just pick what they like.

For the stdlib js files which is shipped with bs-platform, currently it uses .js extension, in such case, it is hard to use such es6 format under JS directly(without jumping hoops), so I am considering changing such files from bs-platform/lib/es6/list.js to bs-platform/lib/es6/list.mjs, would it potentially break anything?


Yeah it would potentially break 99% of the projects, because webpack is usually not set up to handle mjs (in my understanding). Especially it will be higher friction to use ReScript for for instance React-Native where I’ve never seen a mjs extension.

Directly serving files is a bit of fringe use case (what would be a real world use-case?). For performance you usually still do some bundling, even on HTTP2. For node, it can handle .js perfectly fine.

I have never seen any major project use mjs, so if we align with what is most used in the ecosystem why would this be the default?

BTW I don’t think mjs is required, it is just recommended ( Tools like TypeScript (important for interop) may never support mjs.