简体   繁体   中英

How to migrate from Svelte rollup.js to SvelteKit?

I've got a working svelte webapp running with rollup.js. On extending it, I learnt of SvelteKit and realise that it's a better match for my project. How can I migrate from rollup.js to SvelteKit?

Here is the updated URL for migrating to sveltekit from sapper:

https://kit.svelte.dev/docs/migrating

The key point you're probably looking for is to move configuration from your rollup.config.js to svelte.config.js

Preprocessor options are there under config.preprocess

So your svelte.config.js might end up looking like this:

import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';
import image from "svelte-image";

/** @type {import('@sveltejs/kit').Config} */
const config = {
    // Consult https://github.com/sveltejs/svelte-preprocess
    // for more information about preprocessors
    preprocess: [
        preprocess(),
        image(),
    ],
    kit: {
        adapter: adapter(),

        // Override http methods in the Todo forms
        methodOverride: {
            allowed: ['PATCH', 'DELETE']
        }
    }
};

export default config;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM