Skip to content

Instantly share code, notes, and snippets.

@kt3k
Created May 25, 2022 15:32
Show Gist options
  • Save kt3k/feaf665b0ad89ef9e72cf5e92fa09656 to your computer and use it in GitHub Desktop.
Save kt3k/feaf665b0ad89ef9e72cf5e92fa09656 to your computer and use it in GitHub Desktop.
async function checkModuleSupport(name) {
try {
await import(name);
console.log(`✅ ${name} is supported`);
} catch {
console.log(`❌ ${name} is not supported`);
}
}
for (const mod of [
"buffer",
"child_process",
"crypto",
"console",
"constants",
"cluster",
"dgram",
"dns",
"domain",
"events",
"fs",
"fs/promises",
"http",
"http2",
"https",
"inspector",
"net",
"os",
"path",
"process",
"punycode",
"querystring",
"readline",
"repl",
"stream",
"timers",
"timers/promises",
"tls",
"tty",
"url",
"util",
"v8",
"vm",
"worker_threads",
"zlib",
]) {
await checkModuleSupport(mod);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment