graphql-request
graphql-request copied to clipboard
Upgrade to newer form-data SSR error
I have an preact SSR application and when I try to build it preact build I recieve:
Unable to read file: /node_modules/graphql-request/node_modules/form-data/lib/browser.js
ReferenceError: window is not defined
method: oYKm
package form-data fixed this issue here https://github.com/form-data/form-data/pull/496
Since the SSR does not have a window-object we need to check that it exists, no requests are performed on the server but the rendering will complain about this use of the window-variable.
the solution to this is here, and they have added fix
module.exports = typeof self == 'object' ? self.FormData : typeof window !='undefined' ? window.FormData : undefined;
So please upgrade to newer version of form-data