mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 18:17:48 -05:00
f091d1ad69
This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though.
12 lines
491 B
Text
12 lines
491 B
Text
file:///[WILDLINE]/file.js
|
|
error: Uncaught (in promise) ReferenceError: require is not defined
|
|
console.log(require);
|
|
^
|
|
at [WILDCARD]
|
|
|
|
info: Deno supports CommonJS modules in .cjs files, or when the closest
|
|
package.json has a "type": "commonjs" option.
|
|
hint: Rewrite this module to ESM,
|
|
or change the file extension to .cjs,
|
|
or add package.json next to the file with "type": "commonjs" option.
|
|
docs: https://docs.deno.com/go/commonjs
|