Skip to content

Commit

Permalink
use ssr = false in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Jun 13, 2024
1 parent e57ae21 commit 668b899
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/routes/+page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// We only need to load this in the browser, not the server
export const ssr = false;
16 changes: 1 addition & 15 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
<script>
import { onMount } from 'svelte';
import { browser } from '$app/environment';
let examples;
async function browserLoad() {
if (!import.meta.env.SSR && browser) {
// This code will only run in the browser
let ex = await import('$examples/index.js');
examples = ex.default;
} else {
// This code will only run in the server
console.log('server', browser);
}
}
browserLoad();
import examples from '$examples/index.js';
</script>

<div>
Expand Down

0 comments on commit 668b899

Please sign in to comment.