Open purecopy opened 3 years ago
For now I got things working using the Vite external
options for SSR.
{
ssr: {
external: ['glider-js']
}
}
hi ! why load glider on server side ? you need to slide only on client. just load content on server and init glider on client load ;) gl
external: ['glider-js']
can you tell me where did you add the configuration?
external: ['glider-js']
can you tell me where did you add the configuration?
@mylastore I used the vite config prop from the svelte kit config obj in svelte.config.js
Edit: svelte-kit docs: https://kit.svelte.dev/docs#configuration-vite vite docs: https://vitejs.dev/guide/ssr.html#ssr-externals
I used the vite config prop from the svelte kit config obj in
svelte.config.js
Edit: svelte-kit docs: https://kit.svelte.dev/docs#configuration-vite vite docs: https://vitejs.dev/guide/ssr.html#ssr-externals
I added this to svelte.config but did not work for me, I am still getting and error any ways I am using this for now
vite: () => ({
ssr: {
external: ['glider-js']
}
})
@mylastore are you using the noExternal
prop?
so you might need to filter external deps also
const external = ['glider-js'],
const config = {
kit: {
vite: () => ({
ssr: {
noExternal: Object.keys(pkg.dependencies).filter(
(dep) => !external.includes(dep),
),
external,
},
}),
},
};
@mylastore are you using the
noExternal
prop?
What does noExternal mean? I guess no NPM module? Some module created locally?
Never mine above. I added the configuration suggested and now I am getting
pkg is not defined
pkg is not defined
@mylastore Sorry my bad, I missed it in the previous snippet.
You are most likely missing the import for the package.json like:
with require
const pkg = require('./package.json');
with es6
import path from 'path';
import fs from 'fs';
const pkg = JSON.parse(fs.readFileSync(path.resolve('./package.json')));
Hi, first things first: I love this lib and really appreciate your work so far! 🙂
I am currently having some problems to make things work with Vite SSG (SvelteKit) and wondered if you can help me out. In the build process I get
at https://github.com/NickPiscitelli/Glider.js/blob/f5d9ed220674ba01a6de3a4969cbe6059c1b5301/glider.js#L29-L31
I already tried to dynamically import the module without luck.
todo: