Skip to content

Exclude react from bundle, and include it directly from the layout #1275

@YoussefTaghlabi

Description

@YoussefTaghlabi

I'm including React directly from my layout, and I would like webpack to exclude it from the bundle, and make react refers to the window global object React

I'm using the following:

{
        ...
        externals: {
            // Use external version of React
            "react": "React"
        },
        plugins: [
            new webpack.IgnorePlugin(/react/)
        ]
        ...
}

react gets excluded from the bundle, but client side I'm getting Uncaught Error: Cannot find module "react".

Any hints?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions