Adapter for Svelte apps that creates a Vercel app, using a function for dynamic server rendering.
Add "@sveltejs/adapter-vercel": "next"
to the devDependencies
in your package.json
and run npm install
.
Then in your svelte.config.js
:
import vercel from '@sveltejs/adapter-vercel';
export default {
kit: {
...
adapter: vercel()
}
};
As an escape hatch, you may optionally specify a function which will receive the final esbuild options generated by this adapter and returns a modified esbuild configuration. The result of this function will be passed as-is to esbuild. The function can be async.
For example, you may wish to add a plugin:
adapterVercel({
esbuild(defaultOptions) {
return {
...defaultOptions,
plugins: []
};
}
});
The default options for this version are as follows:
{
entryPoints: ['.svelte-kit/vercel/entry.js'],
outfile: `pathToLambdaFolder/index.js`,
bundle: true,
inject: ['pathTo/shims.js'],
platform: 'node'
}