-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Window is not defined #163
Comments
I resolved the problem by adding vite-plugin-iso-import plugin like in last answer: |
I had same error in html2pdf and svelte-apexcharts and here is how to solve it in 3 simple steps:
|
The adapter static may not be installed in your dev dependency, so make sure to run |
Thats not how it works. This is the correct command (for nodejs 18): |
I am getting the following error:
This is my svelte.config.js:
|
@strenkml -- Remove :
and
from svelte.config.js -- Go to vite.config.ts and add example of my vite.config.ts:
after that in the page that use the apex chart include the following line:
|
While trying to set up chart from the README.md, I have received an error:
ReferenceError: window is not defined
I've tried all of ideas here: https://kit.svelte.dev/faq#integrations
I had same problem with d3, but I resolved it with adding onMount and typeof window, here is not working
`<script>
import { onMount } from 'svelte';
import { chart } from "svelte-apexcharts";
onMount(() => {
if (typeof window !== "undefined") {
let options = {
chart: {
type: "bar",
},
series: [
{
name: "sales",
data: [30, 40, 35, 50, 49, 60, 70, 91, 125],
},
],
xaxis: {
categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999],
},
};
}
});
</script>`
`import adapter from '@sveltejs/adapter-static';
const dev = process.env.NODE_ENV === 'development';
It may be the problem with my config.svelte.js, so I am pasting it here as well. I am pretty new to Svelte and webdesign, so I may made an mistake there
`
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit:
{
adapter: adapter({
// default options are shown
pages: 'build',
assets: 'build',
fallback: null,
precompress: false
}),
trailingSlash: 'always',
paths: {
base: dev ? '' : '/app',
},
prerender: {
// This can be false if you're using a fallback (i.e. SPA mode)
default: true
},
vite: {
resolve: {
dedupe: ['@fullcalendar/common'],
browser: true,
},
optimizeDeps: {
include:['@fullcalendar/common']
}
}
},
paths: {
base: 'app/'
},
ssr:false,
};
export default config;`
Thank you in advance
The text was updated successfully, but these errors were encountered: