-
-
Notifications
You must be signed in to change notification settings - Fork 115
Description
Environment
- I am using
@preact/signals-core
- I am using
@preact/signals
- I am using
@preact/signals-react
- I understand usage changed in v2, and I've followed the React Integration instructions
Describe the bug
It seems like node_modules/@preact/signals-react/runtime/dist/runtime.mjs
in the distribution package cannot work with React 19 as it contains an eager import for __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
which has been removed in React 19. Seems to originate in https://github.com/preactjs/signals/blob/9022d4a770ce53c3e5c6a571f3ac5193ec2011b4/packages/react/runtime/src/auto.ts#L4C2-L4C71 and it happens even if you do not try to use auto tracking. Apparently everything is bundled into one file during release (?) and when running in Node, this one big module will be imported and fails because of the missing export from React.
To Reproduce
npm i @preact/signals-react && node -e 'import { useSignal } from "@preact/signals-react"; console.log(useSignal);'
Expected behavior
The import available only for React 18 is dynamically imported on demand