Follow-up to
npx react-native@0.66.5 init RN0665 --version 0.66.5
yarn add ses
// index.js
import 'ses'; // added
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
lockdown({consoleTaming: 'unsafe'}); // added
AppRegistry.registerComponent(appName, () => App);
// metro.config.js
const {getDefaultConfig} = require('metro-config');
module.exports = (async () => {
const {
resolver: {sourceExts},
} = await getDefaultConfig();
return {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
sourceExts: [...sourceExts, 'cjs'],
},
};
})();
// babel.config.js
module.exports = {
ignore: [/ses\.cjs/],
presets: ['module:metro-react-native-babel-preset'],
};
yarn start --reset-cache
yarn start ios
Result:
ERROR TypeError: undefined is not a function (near '...globalThis.process.on...')

(this|global|globalThis|window).process in our RN realm contains only {"env": {"NODE_ENV": "development"}}
So our Node API methods (on/exit/abort/etc) are missing https://nodejs.org/api/process.html#process (being an instance of EventEmitter)
Which we now need to be added to our vanilla RN PoC
First seen in
- MMM: RN 0.66.5 + SES 0.18.1
Follow-up to
npx react-native@0.66.5 init RN0665 --version 0.66.5yarn add sesyarn start --reset-cacheyarn start iosResult:
ERROR TypeError: undefined is not a function (near '...globalThis.process.on...')(this|global|globalThis|window).processin our RN realm contains only{"env": {"NODE_ENV": "development"}}global,selfas aliases forglobalThisLavaMoat#459So our Node API methods (on/exit/abort/etc) are missing https://nodejs.org/api/process.html#process (being an instance of
EventEmitter)Which we now need to be added to our vanilla RN PoC
First seen in