Skip to content

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

Description

@guptaashwanee

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions