[Bug] Does not work with preact on production
See original GitHub issueReporting a bug?
After investigation, I found that https://github.com/react-static/react-static/blob/87ea29379f4a8a73612db198c0bc5c021ba60366/packages/react-static/src/bootstrapApp.js#L19 line crashes.
Environment
Run and copy the result of:
System:
OS: macOS 10.15.5
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Memory: 2.27 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.12.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.6 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 85.0.4183.83
Safari: 13.1.1
npmPackages:
react-static: ^7.4.2 => 7.4.2
Steps to Reproduce the problem
- Add preact aliases
yarn react-static build
yarn serve ./dist -p 3000
- Open
http://localhost:3000/
and the browser console.
Expected Behavior
No JS crash
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (12 by maintainers)
Top Results From Across the Web
preactjs/preact-cli - error appearing in production build - GitHub
Are there any settings I could set to create a build application that isn't heavily minified/uglified but still does not yield any errors?...
Read more >Debugging Preact Apps
The main reason this error occurs is that the DOM node isn't present when the render() function is called. Make sure it exists....
Read more >Error handling for production application in Preact
That's it, nothing very difficult. The most difficult thing to do here is registrating to some service like Sentry. You have everything you...
Read more >Error in production after upgrading to react 18 - Stack Overflow
Here is how to do that: Open next.config.js; Comment/remove the part that switches from react to preact in prod.
Read more >Preact is not an alternative I'd reccomend. It's riddled with very ...
Preact is not an alternative I'd reccomend. It's riddled with very serious bugs. I've found it incredibly difficult to work with.
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
👍 I was able to make it work on prod by applying patch to
lib
dir, I also had to remove<Suspense />
to make it work with static export, thus a custom Suspense component with a simpledocument
check should work fine in both dev & prod mode.I just tried this too and i’m getting the same error, i know their suspense support is still experimental, somewhere there must be an incompatibility between how Suspense works in React vs Preact that is causing issues here. I’ll try to look into it a bit more over the weekend.