question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Does not work with preact on production

See original GitHub issue

Reporting a bug?

image

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

  1. Add preact aliases
  2. yarn react-static build
  3. yarn serve ./dist -p 3000
  4. Open http://localhost:3000/ and the browser console.

Expected Behavior

No JS crash

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
huygncommented, Mar 4, 2021

@bastienrobert I guess the problem is that on production build lib folder is used. Therefore, you need to apply the patch to that folder.

👍 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 simple document check should work fine in both dev & prod mode.

2reactions
tbgsecommented, Sep 2, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found