Skip to content

Commit

Permalink
Merge pull request #23 from collinsleewyatt/master
Browse files Browse the repository at this point in the history
Fix ReferenceError when ran outside the browser
  • Loading branch information
mthh authored Dec 17, 2023
2 parents c455428 + a751e51 commit 79cec37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const defaults = {
optionsAttr: 'i18n-options',
useOptionsAttr: false,
parseDefaultValueFromContent: true,
document: document,
// `document` if running inside a browser, but otherwise undefined (prevents reference error when ran outside browser)
document: typeof window !== 'undefined' ? document : undefined,
};

function init(i18next, options={}){
Expand Down

0 comments on commit 79cec37

Please sign in to comment.