Support non-esm modules
The simplicity of it is so cool. It's a proof-of-concept however - i'm a noobie w.r.t. acorn.
Did github mangle the (code.charAt(ast.start) == "" ? "" : "") expressions or is there something I don't understand going on there?
Not github, me - to be able to diff i removed semicolons too agressively.
That should fix it
I don't expect these PR to be accepted right away - please consider them as inspiration, if that's not too much to ask :)
What do you want to do with require calls?
Nothing: most front-end modules come in a single require-able bundle, so exporting module.exports using that patch, es6-style, is just enough to be able to import the npm-installed bundled module.
Though replacing require x by import from x would be elegant but i fear the hidden complexities.
most front-end modules come in a single require-able bundle
In my experience the concept of dependencies is definitely also used in many front-end modules. So shipping a solution that just ignores that doesn't feel very reasonable. (I intentionally didn't provide any support for non-ES modules initially because I'm not that interested in being pulled into the morass of trying to make this work.)