4 ms·
Reading the documentation, it seems that `require` at the top-level should be possible under one of three scenarios: (1) the file extension is "cjs", (2) ther
by koito17 1y ago
Reading the documentation, it seems that `require` at the top-level should be possible under one of three scenarios:
(1) the file extension is "cjs",
(2) there is a package.json file with "type" set to "commonjs", or
(3) a require function is created with createRequire
https://docs.deno.com/runtime/fundamentals/node/#commonjs-support https://docs.deno.com/runtime/fundamentals/node/#commonjs-su...
Seems like the code from the article will run as-is with either of the first two options. In any case, this is what I meant by Deno not being able run the code "unless one explicitly configures" it.