2023-07-05 15:11:16 +02:00
---
title: Invalid webpack resolve alias
---
2019-07-08 14:29:19 +02:00
2023-07-05 15:11:16 +02:00
## Why This Error Occurred
2019-07-08 14:29:19 +02:00
When overriding `config.resolve.alias` incorrectly in `next.config.js` webpack will throw an error because private-next-pages is not defined.
2023-07-05 15:11:16 +02:00
## Possible Ways to Fix It
2019-07-08 14:29:19 +02:00
This is not a bug in Next.js, it's related to the user adding a custom webpack(config) config to next.config.js and overriding internals by not applying Next.js' aliases. Solution would be:
2023-07-05 15:11:16 +02:00
```js filename="next.config.js"
2019-07-08 14:29:19 +02:00
webpack(config) {
config.resolve.alias = {
...config.resolve.alias,
// your aliases
}
}
```
2023-07-05 15:11:16 +02:00
## Useful Links
2019-07-08 14:29:19 +02:00
2020-05-27 23:51:11 +02:00
- [Related issue](https://github.com/vercel/next.js/issues/6681)