零配置部署
当你使用 npx sv create
创建新的 SvelteKit 项目时,它会默认安装 adapter-auto
。部署时,此适配器会自动安装并使用适用于受支持环境的正确适配器:
¥When you create a new SvelteKit project with npx sv create
, it installs adapter-auto
by default. This adapter automatically installs and uses the correct adapter for supported environments when you deploy:
建议在确定目标环境后将适当的适配器安装到你的 devDependencies
,因为这会将适配器添加到你的锁定文件中并略微缩短 CI 上的安装时间。
¥It’s recommended to install the appropriate adapter to your devDependencies
once you’ve settled on a target environment, since this will add the adapter to your lockfile and slightly improve install times on CI.
特定于环境的配置(Environment-specific configuration)
¥Environment-specific configuration
要添加配置选项,例如 adapter-vercel
和 adapter-netlify
中的 { edge: true }
,你必须安装底层适配器 - adapter-auto
不接受任何选项。
¥To add configuration options, such as { edge: true }
in adapter-vercel
and adapter-netlify
, you must install the underlying adapter — adapter-auto
does not take any options.
添加社区适配器(Adding community adapters)
¥Adding community adapters
你可以通过编辑 adapters.js 并打开拉取请求来为其他适配器添加零配置支持。
¥You can add zero-config support for additional adapters by editing adapters.js and opening a pull request.