Skip to content

Commit b7d6643

Browse files
Merge pull request #227037 from craigshoemaker/patch-15
[Static Web Apps] Add Output File Tracing
2 parents e00772a + 4aa49b9 commit b7d6643

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

articles/static-web-apps/deploy-nextjs-hybrid.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,19 @@ Begin by adding an API route.
207207
208208
:::image type="content" source="media/deploy-nextjs/nextjs-api-route-display.png" alt-text="Display the output from the API route":::
209209
210+
## Enable standalone feature
211+
212+
When your application size exceeds 100Mb, the Next.js [Output File Tracing](https://nextjs.org/docs/advanced-features/output-file-tracing) feature helps optimize the app size and enhance performance.
213+
214+
Output File Tracing creates a compressed version of the whole application with necessary package dependencies built into a folder named *.next/standalone*. This folder is meant to deploy on its own without additional *node_modules* dependencies.
215+
216+
In order to enable the `standalone` feature, add the following additional property to your `next.config.js`:
217+
```bash
218+
module.exports ={
219+
output:"standalone",
220+
}
221+
```
222+
210223
## Enable logging for Next.js
211224
212225
Following best practices for Next.js server API troubleshooting, add logging to the API to catch these errors. Logging on Azure uses **Application Insights**. In order to preload this SDK, you need to create a custom start up script. To learn more:

0 commit comments

Comments
 (0)