signals-react doesn't work in react production build
See original GitHub issueThe basic example is not working on production build in react:
const count = useSignal(1);
return (
<div>
{count}
<button onClick={() => count.value++}>INC</button>
</div>
);
Versions:
"@preact/signals-react": "^1.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Building with vite 3.1.0
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:8 (6 by maintainers)
Top Results From Across the Web
@preact/signals-react crashes on production build, at least ...
With react-signals 1.0.2 build for production is now working, but looks like that signals itself is not working at all. At least in...
Read more >Webpack React build doesn't work on production
I am hosting a production build in a subdirectory of my Apache server. I need that property when making production builds.
Read more >App works in development but not in production (doesn't build)
I have a react app that runs fine in development (npm start) and doesn't throw any errors. But when I try to build...
Read more >Optimizing Performance - React
If your project is built with Create React App, run: npm run build. This will create a production build of your app in...
Read more >How and when to force a React component to re-render
In this demo, I built a clock that has a major problem: the time doesn't change after I first load the screen. Not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is fixed by the fantastic PR from @jmeistrich #215 🎉 We’ll cut a new release soon.
@developit No, I don’t think so. I’ve been testing in three different production apps (React 17, 18, React Native) and I don’t see consistent
ReactCurrentOwner
behavior. In production sometimes it’s set to the root node, sometimes it’s always null (I don’t remember which was which).But the solution I ended up with was to use only the dispatcher to track lifecycle, mapping to the rerender function rather than the owner, and that is working great. I submitted a PR to use a similar solution for Signals: https://github.com/preactjs/signals/pull/215