Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Error when evaluating SSR module even when SSR is disabled - svelte-kit

$
0
0

I wanted one of my route in my app not to be server side rendered.The way to do this will be doing export const ssr = false in module script or setting ssr: false in svelte.config.js as mention in svelte docs

But even after disabling ssr in both the ways, I'm still getting errors in terminal like localStorage is not defined which should be not there with ssr disabled.

While app still works find. But whenever i reload the page in browser this error appears on the terminal

[vite] Error when evaluating SSR module /src/routes/index.svelte:ReferenceError: localStorage is not defined

svelte.config.js

import preprocess from 'svelte-preprocess';import adapter from '@sveltejs/adapter-static';/** @type {import('@sveltejs/kit').Config} */const config = {    // Consult https://github.com/sveltejs/svelte-preprocess    // for more information about preprocessors    preprocess: preprocess(),    kit: {        ssr: false,        adapter: adapter({            fallback: '200.html'        }),        prerender: {            enabled: false        },    }};export default config;

index.svelte

<script context="module" lang="ts">    export const ssr = false</script><script lang="ts">    import Yrtc from "./../helpers/Yrtc";    import { onMount } from "svelte";    onMount(() => {        const yrtc = new Yrtc({            roomId: 'tet-riieiiasds-di'        })        console.log({yrtc})    })</script>test

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>