You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using webfontloader via WebPack CommonJS module. Webpack compiles fine but when I load up the JS on the page I get an error
Uncaught TypeError: Cannot read property 'userAgent' of undefined
So userAgent lives on window.navigator so I checked to see what window referred to inside the webfontloader.js file in the node_modules directory and I see it's set to this which is passed in via the module closure.
If I alter the this to window and recompile it works fine.
I'm not sure if this is a webfontloader issue or a misconfig of WebPack. However I've noticed a similar issue #246 which indicates there may have been a similar issue before?
Hmm, there is only one place in the code that reads userAgent and it correctly references window.navigator.userAgent. It looks like webpack isn't setting up the window correctly in this case.
I'm using webfontloader via WebPack CommonJS module. Webpack compiles fine but when I load up the JS on the page I get an error
Uncaught TypeError: Cannot read property 'userAgent' of undefined
So
userAgent
lives onwindow.navigator
so I checked to see whatwindow
referred to inside thewebfontloader.js
file in thenode_modules
directory and I see it's set tothis
which is passed in via the module closure.If I alter the
this
towindow
and recompile it works fine.I'm not sure if this is a webfontloader issue or a misconfig of WebPack. However I've noticed a similar issue #246 which indicates there may have been a similar issue before?
Please can you advise? Web Font Loader v1.6.0
Update: may relate to webpack/webpack#97
The text was updated successfully, but these errors were encountered: