Gatsby import
See original GitHub issueHello,
so I tried the import with Gatsby but, because its SSR, it can’t access the functions needed from the client side. I followed along the steps on the react page: https://splidejs.com/integration-react-splide/
But I only get this error:
ReferenceError: self is not defined
at Object../node_modules/@splidejs/splide/dist/js/splide.esm.js
Could anyone help me set up Splide with Gatsby?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:7
Top Results From Across the Web
Importing Assets Directly into Files - Gatsby
There are two major ways to import assets, such as images, fonts, and files, into a Gatsby site. The default path is to...
Read more >gatsby sass is not working --import error - Stack Overflow
scss' does not contain a default export (imported as 'headerStyles'). I have a header.module.scss and the header.js which contains: import { ...
Read more >gatsby-plugin-utils - npm
It is called internally by Gatsby to validate each plugin's options when a site is started. Example. import { validateOptionsSchema } from " ......
Read more >How To Use Static Files in Gatsby | DigitalOcean
Like many popular Static Site Generators, Gatsby embraces the use of dynamic web ... import * as React from "react" import Layout from...
Read more >How to Set Up Import Aliases for Gatsby | by Malik Elgabroun
The reason why we are setting up import aliases is more to do about readability and the look of our code when importing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This solution works for me, in gatsby-node.js file:
Then, in your component add the next lines:
Src: link
Am I correct in thinking that this essentially forces Splider to render client side?
Either way, the
self is not defined
error relates toself
not being available to NodeJs.I have posted a fix here: #252, as the same issue interrupts Gridsome build. The end result is a fully working SSR rendered splider.