Skip to content

aquacalc/astro-local-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How can I get window in an .mdx file?

Open in StackBlitz

  • Test.svelte persists a Svelte store to local storage using the window object.
  • ✅ I can import & use Test.svelte in /src/pages/good-to-go.astro with the client:only directive, as per the docs:
  import Test from "../components/Test.svelte";

  <Test client:only />
  • ✅ But when I run the same code in /src/pages/no-go.mdx, I get the "Window is not defined" error:

"window is not defined"

  • ✅ (Svelte components that don't depend on window run as expected in a .mdx file.)

How can I get window in the .mdx file?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published