Skip to content

ReactDOM is not defined server side by default #186

@SoonDead

Description

@SoonDead

I'm using React.NET with Webpack.

The internals of my ReactConfig:

ReactSiteConfiguration.Configuration.SetLoadBabel(false)
    .AddScriptWithoutTransform("~/Scripts/build/server.bundle.js");

The server bundle does not contain React. Therefore I put this in my webpack.config.js:

externals: {
    react: 'React',
    "react-dom": 'ReactDOM',
}

ReactDOM is undefined on the serverside.

The workaround will get me fired :(

externals: {
    react: 'React',
    "react-dom": 'React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions