Most of the code in nuxt projects can now be written in modern ES6 syntax. Even more is going to be supported when 8 is next LTS (Such as async/await). However, there are parts currently are not fully ES6 compatible because are being required directly with node and thus depends on pure node functionalities. Also using babel-register to polyfill this gap may introduce many many inconsistencies and perf/stability issues which is not ideal. Current parts which can potentially leverage .mjs
:
nuxt.config.js
This article is useful for getting started with native esm. Currently, esm support can be enabled behind a flag so we would delay this feature for Nuxt until it gets stable enough.
PS: Any ideas, feedbacks, and contribution are welcome. our only limitation is that PRs should target v2 as this is almost breaking change in the entire ecosystem.
XREFs: