繁体   English   中英

如何从 Svelte rollup.js 迁移到 SvelteKit?

[英]How to migrate from Svelte rollup.js to SvelteKit?

我有一个使用 rollup.js 运行的苗条 webapp。 在扩展它时,我了解了 SvelteKit,并意识到它更适合我的项目。 如何从 rollup.js 迁移到 SvelteKit?

这是更新的 URL 用于从 sapper 迁移到 sveltekit:

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

您可能正在寻找的关键点是将配置从您的 rollup.config.js 移动到 svelte.config.js

预处理器选项在 config.preprocess 下

所以你的 svelte.config.js 可能最终看起来像这样:

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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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