4 ms·
It’ll run via an ESM import of an NPM dependency, Deno just doesn’t allow commonjs at the top level
by dbushell 1y ago
It’ll run via an ESM import of an NPM dependency, Deno just doesn’t allow commonjs at the top level
- simjnd 1y agoThe point still stands
- koito17 1y agoReading 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.