by jkrems · 4y ago · 0 comments
<!-- ok if it's a script only
--> console.log("ok"); const isScript = (x = true) => x <!--x
console.log(isScript()) // true or false depending on whether the code is ESM
What's happening is that `<!--` is a comment token in script mode, but it's parsed as `< ! --` in module mode.