Skip to content

Commit

Permalink
Fix issue with 'window' object not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
tameemsafi committed Sep 17, 2019
1 parent 8ab693c commit efb1ea3
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 84 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -35,10 +35,10 @@
"jest": "^24.8.0",
"lolex": "^4.1.0",
"regenerator-runtime": "^0.13.2",
"webpack": "^4.35.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.5",
"webpack-merge": "^4.1.4"
"webpack": "^4.40.2",
"webpack-bundle-analyzer": "^3.5.0",
"webpack-cli": "^3.3.9",
"webpack-merge": "^4.2.2"
},
"dependencies": {
"prop-types": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion src/core/Typewriter.js
Expand Up @@ -78,7 +78,7 @@ class Typewriter {
this.addEventToQueue(EVENT_NAMES.CHANGE_CURSOR, { cursor: this.options.cursor }, true);
this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, null, true);

if(!window.___TYPEWRITER_JS_STYLES_ADDED___ && !this.options.skipAddStyles) {
if(window && !window.___TYPEWRITER_JS_STYLES_ADDED___ && !this.options.skipAddStyles) {
addStyles(STYLES);
window.___TYPEWRITER_JS_STYLES_ADDED___ = true;
}
Expand Down
1 change: 1 addition & 0 deletions webpack/common.config.babel.js
Expand Up @@ -13,6 +13,7 @@ const config = {
library: 'Typewriter',
libraryTarget: 'umd',
libraryExport: 'default',
globalObject: 'typeof self !== \'undefined\' ? self : this',
umdNamedDefine: true,
},

Expand Down

0 comments on commit efb1ea3

Please sign in to comment.