admin管理员组

文章数量:1026989

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?

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?

本文标签: viteHow to stop SvelteKit from refreshing the browser when an API endpoint39s code is changedStack Overflow