Skip to content

Uncaught ReferenceError: require is not defined #3434

@ashubham

Description

@ashubham

This is most probably due to this snippet of code in apollo-client:

export function requireReactLazily(): typeof import('react') {
  return React || (React = require('react'));
}

I am using plugin-commonjs/node-resolve.
Output format: esm

Expected Behavior

Rollup should bundle React along with apollo-client. And not fail during runtime.

Actual Behavior

App load fails with require is not defined error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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