-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
using global "window" causing server-side to blow up #17
Comments
Hi, I have no idea for this, there's no DOM-related things used in this package, it seems like the feature of axios, but there's no more information to dig out the reason. |
Thanks |
I had the same problem while working with Gatsby. Checking for if (typeof window !== 'undefined') {
const useAxios = require('@use-hooks/axios');
return useAxios.default({
// ...
})
} For some reason, I had to call |
@dlbnco reopened and look for more feedback |
same problem |
It may be related with this axios/axios#244 |
same problem |
I use the next.js framework and like other SSR frameworks, builds the app in node. I'm getting the error I'm pasting below from "I have no idea where" but I think it might be inside react-hooks-axios using the window object. Is that possible. Feel free to close right away if this isn't the case and sorry for the trouble.
ReferenceError: window is not defined
at Object. (/Users/peterkellner/Documents/pluralsight-course-using-react-hooks/05-Combing-React-Hooks-REST-Example/_experimental/M3-clip10-useMemo-to-Cache-Speaker-Sorted-Data/node_modules/
use-hooks/axios/dist/index.js:1:361
Module._compile
internal/modules/cjs/loader.js:689:30
Module._extensions..js
internal/modules/cjs/loader.js:700:10
Module.load
internal/modules/cjs/loader.js:599:32
tryModuleLoad
internal/modules/cjs/loader.js:538:12
Function.Module._load
internal/modules/cjs/loader.js:530:3
Module.require
internal/modules/cjs/loader.js:637:17
require
internal/modules/cjs/helpers.js:22:18
@use-hooks/axios
webpack:/external "@use-hooks/axios":1
The text was updated successfully, but these errors were encountered: