Skip to content

Commit

Permalink
Add clarity in docs for using exportPathMap with getStaticPaths (#…
Browse files Browse the repository at this point in the history
…39813)

This PR adds a warning note for using the exportPathMap function with getStaticPaths. Any routes defined with EPM will get overridden if that page uses GSP.
Bug

 Related issues linked using #534
 Integration tests added
 Errors have helpful link attached, see contributing.md

Feature

 Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
 Related issues linked using fixes #number
 Integration tests added
 Documentation added
 Telemetry added. In case of a feature if it's used or not.
 Errors have helpful link attached, see contributing.md

Documentation / Examples

 Make sure the linting passes by running pnpm lint
 The examples guidelines are followed from our contributing doc
  • Loading branch information
MaedahBatool committed Aug 22, 2022
1 parent 827e120 commit e307096
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/advanced-features/static-html-export.md
Expand Up @@ -31,6 +31,8 @@ Running `npm run build` will generate an `out` directory.

For more advanced scenarios, you can define a parameter called [`exportPathMap`](/docs/api-reference/next.config.js/exportPathMap.md) in your [`next.config.js`](/docs/api-reference/next.config.js/introduction.md) file to configure exactly which pages will be generated.

> **Warning**: Using `exportPathMap` for defining routes with any `getStaticPaths` powered page is now ignored and gets overridden. We recommend not to use them together.
## Supported Features

The majority of core Next.js features needed to build a static site are supported, including:
Expand Down
4 changes: 3 additions & 1 deletion docs/api-reference/next.config.js/exportPathMap.md
Expand Up @@ -40,7 +40,7 @@ module.exports = {
}
```

Note: the `query` field in `exportPathMap` cannot be used with [automatically statically optimized pages](/docs/advanced-features/automatic-static-optimization) or [`getStaticProps` pages](/docs/basic-features/data-fetching/get-static-props.md) as they are rendered to HTML files at build-time and additional query information cannot be provided during `next export`.
> Note: the `query` field in `exportPathMap` cannot be used with [automatically statically optimized pages](/docs/advanced-features/automatic-static-optimization) or [`getStaticProps` pages](/docs/basic-features/data-fetching/get-static-props.md) as they are rendered to HTML files at build-time and additional query information cannot be provided during `next export`.
The pages will then be exported as HTML files, for example, `/about` will become `/about.html`.

Expand Down Expand Up @@ -79,6 +79,8 @@ module.exports = {
next export -o outdir
```

> **Warning**: Using `exportPathMap` for defining routes with any `getStaticPaths` powered page is now ignored and gets overridden. We recommend not to use them together.
## Related

<div class="card">
Expand Down

0 comments on commit e307096

Please sign in to comment.