Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hypernova SSR Example Doesn't Work #58

Closed
baranyildirim opened this issue Feb 6, 2021 · 7 comments
Closed

Hypernova SSR Example Doesn't Work #58

baranyildirim opened this issue Feb 6, 2021 · 7 comments

Comments

@baranyildirim
Copy link

baranyildirim commented Feb 6, 2021

I followed the Hypernova SSR example, but the webpages I receive are completely blank.

Tried to run the example directly, the following error occurs on the hypernova server:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module

Any idea why this could be?

@baranyildirim baranyildirim changed the title Hypernova issues Hypernova server: SyntaxError Feb 6, 2021
@baranyildirim baranyildirim changed the title Hypernova server: SyntaxError Hypernova SSR Example Doesn't Work Feb 7, 2021
@marteinn
Copy link
Member

marteinn commented Feb 7, 2021

Hi @baranyildirim and thanks for reporting this issue! By looking at the error, it seems like babel register has not been applied, its the bit here https://github.com/marteinn/django-react-polls-with-hypernova-examples/blob/master/example_2_with_builtin_hydration/frontend/hypernova-bootstrap.js#L4 that makes sure hypernova can support ES modules.

Before I do any research (it takes a little while to get the project running), have you followed the installation guide or done any changes? The installation guide is here: https://github.com/marteinn/django-react-polls-with-hypernova-examples/tree/master/example_2_with_builtin_hydration#installation

@baranyildirim
Copy link
Author

Hey @marteinn, thanks for responding.

For the example, I followed the installation guide but used yarn because npm was very slow.

Beyond the example, would it be okay if instead of using the hypernova bootstrapper, I point hypernova directly to babel bundles? This is what I do in my own application, because I want the ability to deploy hypernova easily.

I am pretty sure I have got almost everything right, but my website ends up being blank where the react should be. I know that the Django template is loaded and the SSR is inserted, but get a blank nonetheless.

@marteinn
Copy link
Member

marteinn commented Feb 7, 2021

Thanks for the additional info @baranyildirim, I just set it up locally and also got a ES module error, seems like something has broke since I set up this repo. Doing some research now, will report back when I know more.

@marteinn
Copy link
Member

marteinn commented Feb 7, 2021

Found the culprit, I found the issue while reading through issues for esm (standard-things/esm#868), so it's basically Node introducing a breaking change in v12.16+ and it's an open issue for ESM.

The forward here is either:

My immediate action will be to pin the node version for this repo, at the moment I don't have time to find a more sustainable solution, but PR:s are of course much welcome!

@marteinn
Copy link
Member

marteinn commented Feb 7, 2021

Just pushed out a quickfix: marteinn/django-react-polls-with-hypernova-examples@61dca48

I'm also planning on closing this issue (will keep it open a couple of hours more for discussions) and instead open up a new issue at the https://github.com/marteinn/django-react-polls-with-hypernova-examples repo, as it is not a DRTT issue but rather in one of the examples. (DRTT has no opinion on how you do implement your hypernova server.)

@marteinn
Copy link
Member

marteinn commented Feb 7, 2021

And here is the issue I opened on the other repo: marteinn/django-react-polls-with-hypernova-examples#1 (I noticed that issues was deactivated for the repo, so I activated those as well).

@baranyildirim
Copy link
Author

Tried the example again and it works with Node 12.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants