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

window is not defined error with Remix 2.0 #364

Open
wdj82 opened this issue Oct 10, 2023 · 4 comments · May be fixed by #401
Open

window is not defined error with Remix 2.0 #364

wdj82 opened this issue Oct 10, 2023 · 4 comments · May be fixed by #401

Comments

@wdj82
Copy link

wdj82 commented Oct 10, 2023

Trying to upgrade my project to remix 2.0. In remix 1.8 I have no problem with react-email-editor v1.7.7.

Upgrading to remix 2.0 I'm getting the following error:
image

I get the same error in remix 1.8 with newer versions but not 1.7.7

@wdj82 wdj82 closed this as completed Oct 10, 2023
@wdj82 wdj82 reopened this Oct 10, 2023
@jamiemcconnell
Copy link

It also works on v1.7.8 on remix@2.0.1

@wdj82
Copy link
Author

wdj82 commented Oct 10, 2023

I did get it working after more fiddling with remix settings. Seems it has to be set for cjs and not esm. But still get the window not defined error with 1.7.9

@DerJacques
Copy link

I don't think the issue is strictly related to Remix.
The problem was likely introduced in this commit (@brunolemos FYI).

The problem is that window.__unlayer_lastEditorId = window.__unlayer_lastEditorId || 0; is executed as a side effect as soon as the file is imported. This breaks SSR for any file that includes react-email-editor.

Going back to version 1.7.8 of react-email-editor fixes the problem.

@hojjatramezani
Copy link

I am using Nextjs version 13.0.0 or 13.4.7.
But there is this problem for me. Both on version react-email-editor 1.7.8 and on version react-email-editor 1.7.9
2023-12-10 09_00_19-Window
.
.
This problem occurs when I want to build

@brunolemos brunolemos linked a pull request May 8, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants