Import bug with SSR
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior?
**If we use NextJS (Server Side Rendering), we can’t normaly import Places with import Places from 'places.js'
. ‘window is not defined’. **
What is the expected behavior? Import normaly with SSR
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Bug with building SSR for reactjs-website - node.js
I have some react-app and trying to enable server-side rendering. I make the server/index.js and describe the server logic (using express ).
Read more >Using Non-SSR Friendly Components with Next.js
It allows you to import JavaScript modules dynamically and works collaboratively with SSR as well. You can use the ssr: false object to...
Read more >Svelte SSR Hydration Bug - StackBlitz
non-sveltekit hydration bug reproduction. ... <script>. const is_ssr = import.meta.env.SSR;. </script>. <div>1</div>. {@html "one"}.
Read more >Troubleshooting - Astro Documentation
This error can be thrown when trying to import or render an invalid ... This can be useful for debugging differences between the...
Read more >Has anyone run into issues with a vite SSR import error?
3:10:42 p.m. [vite] Error when evaluating SSR module ... [Bug] - [Help] || Azure Pipelines 'private nuget package cache' not updating ...
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 FreeTop 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
Top GitHub Comments
@Haroenv Hmm, it’s strange, it seems that the issue here is caused by
Zepto
inautocomplete.js
even when just doing an import.Here is what I get when importing locally:
@Benoit-Ferrer In the meantime, can you follow the FAQ of Zeit and wrap the require in an
if
statement? https://github.com/zeit/next.js/wiki/FAQ#i-use-a-library-which-throws-window-is-undefined like so:Looks like this is solved for you, feel free to comment with a reproducible example if this still isn’t what you expected 😃