Skip to content

Bug: Can't import react-devtools-core in NodeJS environment #33103

Open
@deniz-blue

Description

@deniz-blue

I'm writing a custom react renderer that completely runs inside NodeJS.

When I try to import react-devtools-core, this error occurs:

webpack://ReactDevToolsBackend/webpack/universalModuleDefinition:10
})(self, () => {
 ^


ReferenceError: self is not defined
    at Object.<anonymous> (webpack://ReactDevToolsBackend/webpack/universalModuleDefinition:10:2)
    at Module._compile (node:internal/modules/cjs/loader:1734:14)
    at Object.transformer (C:\Users\dennis\AppData\Local\pnpm-cache\dlx\gxuwnoud2xciwjjtv2xv6oox4u\19691f41bd2-2c40\node_modules\.pnpm\tsx@4.19.4\node_modules\tsx\dist\register-D2KMMyKp.cjs:2:1186)
    at Module.load (node:internal/modules/cjs/loader:1469:32)
    at Function._load (node:internal/modules/cjs/loader:1286:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at <anonymous> (C:\Users\dennis\source\Repos\TheAlan404\games-bot\src\devtools.ts:5:47)

Node.js v23.11.0

Repo to repro:
https://github.com/deniz-blue/games-bot/tree/dba1d46ab6346844cb05e4a1978f0275ba062bb1

I think this is an issue about how react compiles and publishes that package

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions