Last active
April 4, 2022 06:56
-
-
Save eladroz/53f758651e4be968f3caefff112286cd to your computer and use it in GitHub Desktop.
SvelteKit config with custom Vite plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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