1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00
denoland-deno/cli/tests/testdata/npm/registry/@denotest/create-require/1.0.0/index.js
2022-11-19 20:32:39 +09:00

19 lines
409 B
JavaScript

import { createRequire } from "module";
console.log(typeof createRequire(import.meta.url));
console.log(typeof createRequire(new URL(import.meta.url)));
try {
createRequire("https://example.com/");
} catch (e) {
console.log(e.message);
}
try {
createRequire(new URL("https://example.com/"));
} catch (e) {
console.log(e.message);
}
try {
createRequire(1);
} catch (e) {
console.log(e.message);
}