blitz icon indicating copy to clipboard operation
blitz copied to clipboard

Fix how `next.config.js` is generated in codemod

Open itsdillon opened this issue 3 years ago • 0 comments

What is the problem?

https://github.com/blitz-js/blitz/blob/6559c25f71326df4fa81ebfc0eb25208ecab5d28/packages/codemod/src/upgrade-legacy.ts#L47

The codemod currently create a next.config.js from scratch without taking into account the webpack config & middlewares inside blitz.config.ts.

Solution:

We should be rename blitz.config.ts to next.config.js & simply wrap the config with withBlitz.

Note: Exclude the middleware array that can be found inside the config

Example:

module.exports = withBlitz(config)

itsdillon avatar Jul 25 '22 22:07 itsdillon