cherry
cherry copied to clipboard
Make output format (ES6, .cjs, ...) configurable
I think we could make ES6 output vs .cjs or whatever else output configurable, so the compiler API gives you some options, for e.g. when you want to integrate the compiler in a REPL, browser, etc. Reloading ES6 modules is a bit painful so having some "dev" mode or "playground" mode vs "optimized build" mode could be a good idea.
Well, es6 modules are closed for a reason, I think. It makes analyzing / caching / tree-shaking / etc a lot easier. So having the es6 module is good, but in some scenarios you might just want to get a JS snippet and js/eval that inside a browser, while not having the import and export stuff.