Skip to content

RN 0.66.5 + npm SES 0.18.1: Babel fails to ignore ses.cjs #10

Closed
@leotm

Description

@leotm

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'],
    },
  };
})();

echo 'ses.cjs' > .babelignore

npx browserslist@latest --update-db (recommended)

yarn start --reset-cache

yarn start ios

Result: endojs/endo#659

Expectation: Same result as

  • curl -O https://npmfs.com/download/ses/0.18.1/dist/lockdown.umd.js
  • echo 'lockdown.umd.js' > .babelignore
  • import './lockdown.umd.js'; instead of ses npm pkg
  • leading to ERROR TypeError: undefined is not a function (near '...globalThis.process.on...') to tackle next (with e.g. rn-nodeify)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions