Next.js Discord

Discord Forum

React import being remove

Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
I am migrating an app from the pages directory to app directory and am running into an issue where one of the transplied dependency files is having it's import React from 'react' removed and is throwing errors (Internal error: ReferenceError: React is not defined). I believe the issue is because I am using react-native-web which still requires the default React import, although I am not sure since it works in the pages dir. Anyways, monkey patching the dependency with the error in the node_modules folder to have import React from 'react' seems to make everything work.

Now I am trying to figure out in which step of the build process this is happening and how I can change this step. I am guessing it is a SWC configuration issue, but again, I am not sure. Can anyone offer some insights?

0 Replies