react native sudden Unable to resolve module `fs` error

For me, the issue was that VSCode had inserted some imports at the top of one of my js files. Very odd. These were the lines:

import { tsConstructorType } from '@babel/types';
import { logger } from 'handlebars';

One of my node modules is depending on react-native-dotenv, but its code was using old import like import {} from 'react-native-dotenv'. But latest version of dotenv is using import {} from '@env'. Fixing this import in the module resolved the problem.