Skip to content

Commit

Permalink
docs: add documentation on minimizing lambda bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
khuezy committed Jul 29, 2023
1 parent 274d446 commit 1b15b11
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,25 @@ await build({

This feature is currently **experimental** and needs to be opted into. It can significantly decrease the server function's cold start time. Once it is thoroughly tested and its stability is confirmed, it will be enabled by default.

#### Reducing Bundle Size

Next will incorrectly trace dev dependencies to be included in the output `node_modules`, which will significantly increase the lambda bundle. For example, the @swc/core-\* binary is ~33MB!

Add this to your next.config.js to help minimize the lambda bundle size:

```typescript
outputFileTracingExcludes: {
'*': [
'**@swc/core**',
'**esbuild**',
'**webpack**',
'**uglify**',
],
},
```

NOTE: NextJS currently doesn't expose an environmental variable to set this so `open-next` cannot programmatically set this like it does for `mode` and `outputFileTracingRoot`

#### Reusing same bucket for asset and cache

Typically, asset files are uploaded to the root of the bucket. However, you might want to store them in a subfolder of the bucket, for instance, when:
Expand Down

0 comments on commit 1b15b11

Please sign in to comment.