Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Get current module URL (browser) console.log(import.meta.url); // → "https://example.com/js/utils.js" // Load a file relative to the current module const response = await fetch(new URL("./data.json", import.meta.url)); const data = await response.json(); // Vite/webpack environment variables if (import.meta.env.DEV) { console.log("Development mode"); }
Result
Open