Package Exports
- @yarbsemaj/adapter-lambda
- @yarbsemaj/adapter-lambda/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@yarbsemaj/adapter-lambda) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
adapter-lambda for SvelteKit
An adapter to build a SvelteKit app into a lambda ready for deployment with lambda proxy.
Installation
npm install --save-dev @yarbsemaj/adapter-lambdaUsage
In your svelte.config.cjs configure the adapter as bellow;
import preprocess from 'svelte-preprocess';
import serverless from '@yarbsemaj/adapter-lambda';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: preprocess(),
kit: {
target: '#svelte',
adapter: serverless(),
},
};Copy serverless.yml from the root of this repo to the root of your project
After building your app run sls deploy to deploy code to AWS using build tool serverless.
Your app can then be accessed via the CloudFront distribution created as aprt of the stack.
Static Assets and precompiled pages
To server static assets and precompiled pages this adapter makes use of S3. In order to route traffic the correct destination a Lambda@edge fuction is used to perfrom a origin rewrite is used to redirect traffic to the S3 Bucket.