Error message:
file.js:1 uncaught referenceerror: require is not defined
Browser-based
require()
does not exist within the browser javascript. Use import defaultExport from "module-name"
or import { export1 } from "module-name";
Node.js
require()
can only be used if the module.exports
syntax is used, removed "type":"module"
from the package
.json
and rename any files with the .
mjs
extension to .js
.