Ask coding questions

← Back to all posts
.mjs files don't syntax highlight as Javascript
sbrl (3)

I'm using Javascript modules (<script src="" type="module" />), and using JS module files with the extension .mjs.

Unfortunately, isn't recognising these as Javascript files.

Is this a bug?

eankeen (2243)

yeah it's a bug. i would expect highlighting as well - on replit i've suffixed es modules with .js in the past and it has worked, so maybe try that :)

eankeen (2243)

oh and one hot tip, javascript modules are run in script mode automatically by the engine, so that use script string at the top is redundant