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

Fix ReferenceError when ran outside the browser #23

Merged
merged 1 commit into from
Dec 17, 2023
Merged

Fix ReferenceError when ran outside the browser #23

merged 1 commit into from
Dec 17, 2023

Conversation

collinsleewyatt
Copy link
Contributor

Hi,

I'm using loc-i18next to make a Parcel transformer so I can statically render the HTML, however the code will return a ReferenceError if the document object does not exist (eg. in a node environment or otherwise outside the browser). I've modified this line so it will work in both browser and non-browser contents.

  • Browser will use document
  • Non-browser will be undefined.

I've tested this in both browser and node and both appear to work.

@mthh
Copy link
Owner

mthh commented Dec 17, 2023

Hi, and thanks for your PR !

Looks good to me, I'm merging it and I will publish a new release soon.

@mthh mthh merged commit 79cec37 into mthh:master Dec 17, 2023
@mthh
Copy link
Owner

mthh commented Dec 17, 2023

New version is published on npm !

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 this pull request may close these issues.

2 participants