add raw HTML with inside Gatsby React page

You can inject external scripts (with no npm modules) to gatsby.js project in many ways. Prefer to use respective gatsby-plugin for “web-analytics” scripts. Using require() : Create a file in your project myScript.js and paste the script content Add const myExtScript = require(‘../pathToMyScript/myScript’) to a statefull component at the Pages folder inside render() and before … Read more

Gatsby Failed Build – error “window” is not available during server side rendering

When dealing with third-party modules that use window in Gatsby you need to add a null loader to its own webpack configuration to avoid the transpilation during the SSR (Server-Side Rendering). This is because gatsby develop occurs in the browser (where there is a window) while gatsby build occurs in the Node server where obviously … Read more

Import SVG as a component in Gatsby

As you said, there are plugins to achieve this, which means a cleaner code (not the full SVG tag inlined in the component) with the same final result. Using gatsby-plugin-react-svg plugin you just need to import your SVG like this: import Icon from “./path/assets/icon.svg”; To install, you only need to add the dependency using npm … Read more

Node.js 17.0.1 Gatsby error – “digital envelope routines::unsupported … ERR_OSSL_EVP_UNSUPPORTED” [duplicate]

This might help. Add these scripts in the package.json file. React: “scripts”: { “start”: “export SET NODE_OPTIONS=–openssl-legacy-provider && react-scripts start”, “build”: “export SET NODE_OPTIONS=–openssl-legacy-provider && react-scripts build” } or “scripts”: { “start”: “react-scripts –openssl-legacy-provider start”, “build”: “react-scripts –openssl-legacy-provider build”, } Vue.js: “scripts”: { “serve”: “export NODE_OPTIONS=–openssl-legacy-provider && vue-cli-service serve”, “build”: “export NODE_OPTIONS=–openssl-legacy-provider && vue-cli-service build”, … Read more