admin管理员组

文章数量:1122832

I'm getting the error

22.93 [Error: require() of ES Module file:///app/node_modules/react/index.js not supported.] {
22.93   code: 'ERR_REQUIRE_ESM'
22.93 }
22.93 
22.93 > Build error occurred
22.93 Error: Failed to collect page data for /dashboard
22.93     at <unknown> (/app/node_modules/next/dist/build/utils.js:1234:15) {
22.93   type: 'Error'
22.93 }

where this is my index.js in the react module

'use strict';

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./cjs/react.production.min.js');
} else {
  module.exports = require('./cjs/react.development.js');
}

I'm unsure how to go about this as i've seen many similar errors online but it was associated with other modules and not react.

Any help would be appreciated!

本文标签: reactjsrequire() of ES Module fileappnodemodulesreactindexjs not supportedStack Overflow