Zero config ES Modules support in Quokka

Node.js supports most ES2015–2018 features and even many ESNext features, however ES modules support is still being implemented and it is uncertain when the feature is going to land unflagged.

Using Babel to compile ES modules to CommonJs is always an option, and often a necessity for production builds.

However, if you just want to run some code using ES modules now and to experiment with it, for example in a tool like Quokka, then installing and configuring Babel just to get ES modules support can ruin your experimenter’s mood quickly. Quick and dirty conversion of import-s to CommonJs require-s may seem like a good option for the experiment’s scratch file, until you realise that you need to load some of your source files or modules that are using ES imports/exports.

Today we are happy to announce that now you can use ES Modules in Quokka with zero config — just open Quokka scratch file in your editor and start typing:

ES Modules zero config support in Quokka.js

The solution is using the awesome standard-things/esm module loader by John-David Dalton. Special thanks go to John for creating the module and for helping with us to create the working solution not only for Quokka but for Wallaby as well, if you would like to run your unit tests in node without Babel transpilation.

We appreciate your feedback, feature requests and bug reports. Also don’t forget to follow us on Twitter to stay up-to-date with the tool’s news. Happy experimenting with Quokka.js!