Skip to content

React strict dom, adding to importSources generates Error: Package subpath './babel' is not defined by "exports" #93

@lotusjohn

Description

@lotusjohn

Hi,
having issue with using rsd in a web project.
Adding this, according to the instructions generates the below error.
This is logged when trying to run in dev, and it also logs the same error during build.

If I remove the importSources stuff, it works to run dev and to build.

Added to vite config

styleX({
      importSources: [
        {
          from: "react-strict-dom",
          as: "css",
        },
      ],
    }),

Output

Error: Package subpath './babel' is not defined by "exports" in /Users/j/Dev/projectName/node_modules/react-strict-dom/package.json

 at exportsNotFound (node:internal/modules/esm/resolve:296:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:643:9)
    at resolveExports (node:internal/modules/cjs/loader:640:36)
    at Function._findPath (node:internal/modules/cjs/loader:748:31)
    at Function._resolveFilename (node:internal/modules/cjs/loader:1235:27)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:141:16)
    at TransformPluginContext.transform (file:///Users/j/Dev/projectName/node_modules/vite-plugin-stylex/src/main.mts:338:35)
    at PluginContainer.transform (file:///Users/j/Dev/projectName/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:49097:19)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at loadAndTransform (file:///Users/j/Dev/projectName/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:51929:27)
    at instantiateModule (file:///Users/j/Dev/projectName/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:52874:44)

Versions of deps

"react": "18.3.1",
"react-dom": "18.3.1",
"react-strict-dom": "0.0.29",
"vite-plugin-stylex": "^0.13.0",
"vite": "^5.4.10",
"@stylexjs/stylex": "^0.9.3",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions