Update For Node.js / NPM
Add "type": "module"
to your package.json
file.
{
// ...
"type": "module",
// ...
}
Note: When using modules, if you get ReferenceError: require is not defined
, you’ll need to use the import
syntax instead of require
. You can’t natively mix and match between them, so you’ll need to pick one or use a bundler if you need to use both.