blitz
blitz copied to clipboard
Fix how `next.config.js` is generated in codemod
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)