I am currently transferring a site from React-Fuse to NextJS with React. Mostly everything is working fine, but upon trying to create a build there is an error that I cannot get around:
> Build error occurred
TypeError: Cannot read property 'b' of undefined
is thrown in every build, it is coming from the __webpack_require__ function at
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
modules[moduleId] is undefined.
I've tried every fix I can find online and nothing seems to be working, any help is appreciated
babelrc is :
{
 "presets": ["next/babel"]
}
next.config has nothing pertaining to webpack, only some redirects
Pages are written as follows:
import SomePage from 'components/aPage/SomePage'
import { connect } from 'react-redux'
import * as AuthActions from 'auth/store/actions'
function mapDispatchToProps(dispatch) {
 ...
}
function mapStateToProps({ user, bank }) {
 ...
}
export default connect(mapStateToProps, mapDispatchToProps)(SomePage)
with the actual jsx file being imported and then connected to the store.
3 Answers 3
Try to clean your ".next" folder and run npm install again.
Comments
Delete your .next folder and run npm install. If it gives error due to version, then run npm install --force
Comments
just delete your .next build folder , node_modules folder and lock.yaml file .
Then rerun the installation script e.g: pnpm install ( Note :based on your package manager you use in your project) .
hope it will work.