You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
I'm think we all must have considered this at some point, but cannot recall.
Q: Is there a safe way for code to test if it is module or not (ie not early/parse error)?
This code would target runtimes supporting import(…) globally, irrespective of semantics, and so my thinking was a clean nice-to-have here could be !!import.meta ? 'module' : 'not' which should not be too much to ask for… thoughts?
I'm think we all must have considered this at some point, but cannot recall.
Q: Is there a safe way for code to test if it is
moduleor not (ie not early/parse error)?This code would target runtimes supporting
import(…)globally, irrespective of semantics, and so my thinking was a clean nice-to-have here could be!!import.meta ? 'module' : 'not'which should not be too much to ask for… thoughts?Possibly Related Discussions
import.meta.mainin import.meta.main node#49440