Skip to content

Commit

Permalink
docs: ✏️ Add case for using another plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dc7290 committed May 19, 2024
1 parent ae4f8de commit 3d9e988
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/docs/02-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,37 @@ module.exports = withExportImages({
})
```

Alternatively, if another plugin is used in conjunction, write

```js title="next.config.js"
const withExportImages = require('next-export-optimize-images')
const withAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})

module.exports = withExportImages(
withAnalyzer({
output: 'export',
// write your next.js configuration values.
})
)
// Or
module.exports = async () => {
const config = await withExportImages({
output: 'export',
// write your next.js configuration values.
})

return withAnalyzer(config)
}
```

:::note

`withExportImages` is an asynchronous function that returns a Promise, so either write `withExportImages` first or wait for the Promise to resolve before applying other plugins.

:::

2. Change the description of the `scripts` that do the `next build` in `package.json`

```diff title="package.json"
Expand Down Expand Up @@ -53,6 +84,11 @@ Alternatively, you can use `next/legacy/image`.
import Image from 'next-export-optimize-images/legacy/image'

<Image src="/images/img.png" width={1920} height={1280} alt="" />
// Or import as follows
import img from './img.png'
<Image src={img} alt="" />
// Or require as follows
<Image src={require('./img.png')} alt="" />
```

## Local checks
Expand Down

0 comments on commit 3d9e988

Please sign in to comment.