Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.19 KB

aws.md

File metadata and controls

41 lines (28 loc) · 1.19 KB

AWS Lambda

Deploy Nitro apps to AWS Lambda.

Preset: aws_lambda

:read-more{title="AWS Lambda" to="https://aws.amazon.com/lambda/"}

Nitro provides a built-in preset to generate output format compatible with AWS Lambda. The output entrypoint in .output/server/index.mjs is compatible with AWS Lambda format.

It can be used programmatically or as part of a deployment.

import { handler } from './.output/server'

// Use programmatically
const { statusCode, headers, body } = handler({ rawPath: '/' })

Inlining chunks

Nitro output, by default uses dynamic chunks for lazy loading code only when needed. However this sometimes can not be ideal for performance. (See discussions in unjs/nitro#650). You can enabling chunk inlining behavior using inlineDynamicImports config.

::code-group

export default defineNitroConfig({
  inlineDynamicImports: true
});
export default defineNuxtConfig({
  nitro: {
    inlineDynamicImports: true
  }
})

::