davidbanham/express-async-errors

ReferenceError: require is not defined in ES module scope, you can use import instead

guptaashwanee opened this issue · 0 comments

This is my start script in package.json

"start": "node --watch --no-warnings=ExperimentalWarning --loader @swc-node/register/esm src/index.ts",

and I have imported like import "express-async-errors"; this

ReferenceError: require is not defined in ES module scope, you can use import instead
at file:///Users/admin/Documents/Ashwanee/node-app/node_modules/express-async-errors/index.js:1:15
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)