Skip to content

Instantly share code, notes, and snippets.

@eladroz
Last active April 4, 2022 06:56
Show Gist options
  • Save eladroz/53f758651e4be968f3caefff112286cd to your computer and use it in GitHub Desktop.
Save eladroz/53f758651e4be968f3caefff112286cd to your computer and use it in GitHub Desktop.
SvelteKit config with custom Vite plugin
import adapter from '@sveltejs/adapter-netlify';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),
vite: {
plugins: [
{
name: 'watch-content',
configureServer(server) {
server.watcher.add('./contentful/');
},
handleHotUpdate(ctx) {
if (ctx.file.includes('contentful')) {
console.log("Contentful update file was changed");
ctx.server.ws.send({
type: 'custom',
event: 'content-update',
});
}
},
},
]
},
},
};
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment