Skip to content Skip to sidebar Skip to footer

Gatsby Xmlhttprequest

In short: I want to use XMLHttpRequest in Gatsby, which works in development mode, but fails in production (gatsby build) mode, which I can't get fixed. Some more information: I w

Solution 1:

It fails during build of html pages because XMLHttpRequest isn't defined ta that time. before using XMLHttpRequest you can check if it is defined.

if(typeof XMLHttpRequest !== "undefined")

see this https://www.gatsbyjs.org/docs/debugging-html-builds/

Post a Comment for "Gatsby Xmlhttprequest"