Skip to content

[Bug]: Not recognized as ES on pnpm #180

@MM294

Description

@MM294

What happened?

⨯ unhandledRejection [ReferenceError: module is not defined in ES module scope This file is being treated as an ES module because it has a '.js' file extension and 'frontend/node_modules/.pnpm/react-onesignal@3.2.3/node_modules/react-onesignal/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.] { type: 'ReferenceError' }

When using pnpm we get this error, we can fix this by renaming

mv node_modules/.pnpm/react-onesignal@3.2.3/node_modules/react-onesignal/dist/index.js node_modules/.pnpm/react-onesignal@3.2.3/node_modules/react-onesignal/dist/index.cjs

What browsers are you seeing the problem on?

Other

What operating system are you running?

macOS 15.5

Steps to reproduce?

Node 20.19.2
pnp 10.11
next 15.1.6
react 19.0.0
reacct-onesignal 3.2.3

pnpm install
next build

What did you expect to happen?

expected it to build

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug_oldSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions