vite - How to stop SvelteKit from refreshing the browser when an API endpoint's code is changed? - Stack Overflow

In SvelteKit, I have an endpoint like this:export async function GET(event: RequestEvent) {return json

In SvelteKit, I have an endpoint like this:

export async function GET(event: RequestEvent) {
    return json({message: "Hello World!"});
}

Simply removing the exclamation mark

export async function GET(event: RequestEvent) {
    return json({message: "Hello World"});
}

causes the browser to refresh which makes no sense. Is there some configuration I can add to stop that from happening?

I tried this:

export default defineConfig({
    server: {
        watch: {
            ignored: ['**/src/routes/api/**']
        }
    },
    plugins: [sveltekit()],
});

but this stops the system from registering any changes to the api endpoints.

How do I stop SvelteKit from restarting the browser when code for API endpoints is changed?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745561732a4633146.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信