-
Notifications
You must be signed in to change notification settings - Fork 35
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
Broken using SSR - Hydrogen #888
Comments
Thanks for trying BudouX. I reproduced the same issue on my end. I believe the problem has several aspects.
Finally, the "window is not defined" problem is gone, but Shopify still encounters a problem using JSDOM with the error "require is not defined." |
Thanks for the quick reply! This issue is quite tricky to get around, although considering many frameworks are moving towards SSR this fix would be a great improvement for BudouX moving forward. Would you have any insight into the "require is not defined" JSDOM error? I'm not quite sure what that's referring to, whether that's within BudouX or Hydrogen... Appreciate the help! |
@jacksontriffon I made a PR #905 to replace JSDOM with linkedom. I no longer see the issue, even after following the reproduction steps you provided. However, you may want to verify that this resolves your needs. |
Many frameworks these days are migrating to a server-side renderred approach with their apps - Since
loadDefaultJapaneseParser()
requires the window object to load, it's currently unusable on Hydrogen.Below is a screenshot of a mock Hydrogen store which breaks when using any
parser
.ReferenceError: window is not defined
Steps to reproduce:
Create a new Hydrogen storefront.
In your terminal, create a new Hydrogen project using example data from Mock.shop
https://shopify.dev/docs/storefronts/headless/hydrogen/getting-started
Run the dev serverAnchor link to section titled "Step 2: Run the dev server"
After installation, open your new project and start the dev server:
Once the dev server is running, open http://localhost:3000/ in your browser and you'll see Mock.shop
Add budoux to the project.
Navigate to file
/app/routes/_index.tsx
(Home page)Update the loader function by adding the parser:
Open http://localhost:3000/ in your browser and you'll see the error.
The text was updated successfully, but these errors were encountered: