Post

I may have misinterpreted the article. Is using .mjs recommended so that v8 can still do streaming compilation for other classic javascript files on the page Or Using mjs enables v8 to do streaming compilation of module scripts?

a million percent; indulging people's irrational aesthetic preference for ".js" was always a grievous error the sole purpose of a file extension for a textual format is to determine the parse goal, and Module is different from Script, and `.js` should have only ever meant Script ¯\_(ツ)_/¯

Wouldn't this be impacted by the "type" declaration in package.json too? I'd expect files with a ".js" extension to be optimized appropriately if I set "type" to "module".

Yes I did. After writing the module, we received feedback from the V8 team (including that the doc you linked is outdated). The problem is that it fails silently so it doesn't show up in a trace. Tomorrow I can send you all the info I have as I'm not on my laptop. Cc @kurtextrem.de