Skip to main content
InterviewHubPRO
Section Overview
Q253

Question 253 of 536

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

47%
JavaScript & V8 Internals (536 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

How do you get the metadata of a module

mid LevelMost AskedCode ExampleEvent LoopPrototypes

You can use the import.meta object which is a meta-property exposing context-specific meta data to a JavaScript module. It contains information about the current module, such as the module's URL. In browsers, you might get different meta data than NodeJS.

javascript
  <script type="module" src="welcome-module.js"></script>;
  console.log(import.meta); // { url: "file:///home/user/welcome-module.js" }