1 2 3 4 5 6
if (import.meta.main) { console.log("main"); } else { console.log("import.meta.url", import.meta.url); throw Error("not main"); }