Open steddyman opened 1 month ago
What versions of svelte-canvas, SvelteKit, and Vite are you using? Have you made any changes to the default configurations in svelte.config.js
or vite.config.js
?
Hi I am using the latest version of svelte-canvas, Svelte is 4.2.8, Vite is 5.1.4 and Sveltekit is 2.5.0. I am using the adapter-node to build the app, but this is just running locally via npm run dev. This is my svelte.config.js:
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte'],
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [vitePreprocess()],
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
},
vite: {
optimizeDeps: {
exclude: ['mongoose']
},
resolve: {
alias: {
$pixel_libs: path.resolve('../pixel_libs') // adjust the path accordingly
}
}
}
};
and this is my vite.configjs
export default defineConfig({
plugins: [sveltekit(), purgeCss()]
});
I wasn't able to reproduce this on my end, even with the same versions and configs. Shot in the dark, but could you try adding 'svelte-canvas'
to config.vite.optimizeDeps.exclude
?
Also, if that doesn't work, could you create a minimum reproducible example to test with?
Hi Sorry for the slow replies. I had a tight deadline for this feature, so I have just implemented it using a raw canvas html element and reactive properties. When I get more time I'll circle back around and try this again. Sorry for the trouble,
I'm not sure if this is supposed to work with Sveltekit or not, but it doesn't for me. Even a single import of the Canvas component fails for me:
It fails with: