3 ms·
import.meta.main (whether the current file is the 'main' or just being required) looks interesting and like something I have wanted in the past, but not sure if
by unilynx 3y ago
import.meta.main (whether the current file is the 'main' or just being required) looks interesting and like something I have wanted in the past, but not sure if it would actually be a good idea.
was it ever offered for standardisation?
- Jarred 3y agoThere is no standard, import.meta is host-defined: 13.3.12.1.1 HostGetImportMetaProperties ( moduleRecord ) The host-defined abstract operation HostGetImportMetaProperties takes argument moduleRecord (a Module Record) and returns a List of Records with fields [[Key]] (a property key) and [[Value]] (an ECMAScript language value). It allows hosts to provide property keys and values for the object returned from import.meta. https://tc39.es/ecma262/#sec-hostgetimportmetaproperties https://tc39.es/ecma262/#sec-hostgetimportmetaproperties