"you appear to be using a native ecmascript module configuration file, which is only supported when running babel asynchronously."

Changing babel.config. to babel.config.cjs did the work. Check babel docs if you need a different config.

This has got to do with Babel settings. The use of .mjs, cjs, or .js extension for the babel.config.extension. In my case where I was running LTE Node 12.6.2, I needed this configuration at the root of my directory babel.config.cjs. cjs is what is applicable for Node.js when using "type"="module". See more about it here on babel docs.

module.exports = {
    presets: [
      [
        '@babel/preset-env',
        {
          targets: {
            node: 'current'
          }
        }
      ]
    ]
  };
  

And jest.config.cjs at the root too. --re-write this and HTML format, in a div without HTML and body element and add class="questionanswerbox" in div element.

In addition to the "cjs" solution, I was able to resolve this issue by converting babel.config.js to babel.config.json:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current"
        }
      }
    ],
    "@babel/preset-typescript"
  ]
}
  
You appear to be using a native ECMAScript module configuration file, Babel asynchronously React Native

Setting the target node version to current? It is also suggested to rename the babel.config.js to babel.config.cjs or babel.config.json.

module.exports = { 
  presets: [
    'module:metro-react-native-babel-preset',
    {
      targets: {
        node: 'current'
      }
    },
    '@babel/preset-env', 
    {
      targets: {
        node: 'current'
      }
    },
    '@babel/preset-react-native',
    {
      targets: {
        node: 'current'
      }
    }
  ]
};
  

I encountered a similar problem, and after reading the Babel site, I concluded that whatever is using your Babel config is not calling it asynchronously. In my case, it was jest 26. I got around the problem by changing the config to a JSON file - babel.config.json. Other people have changed their config file to a CommonJS file - babel.config.cjs. Then you will need to change your config file to be CommonJS, i.e., to use module.exports = {rest of your config}.

The problem is that your package.json says you are using ES6 modules, but your Babel config is using module.exports which is CommonJS (not ES6 modules).

Rename babel.config.js to babel.config.cjs.

To resolve the error "you appear to be using a native ecmascript module configuration file, which is only supported when running babel asynchronously," you can follow these steps:

  1. This error typically occurs when you are using ECMAScript modules (ES modules) in your project and trying to configure Babel using a native ESM configuration file (such as .mjs) instead of a CommonJS file (such as .cjs).
  2. To fix this issue, you need to ensure that your Babel configuration file is in the CommonJS format.
  3. Rename your existing native ESM configuration file (e.g., babel.config.mjs) to a CommonJS file (e.g., babel.config.cjs).
  4. Alternatively, if you want to continue using native ESM configuration, you need to ensure that Babel is running asynchronously. This typically involves using tools like esbuild or setting up your build pipeline to handle native ESM configurations.
  5. After making the necessary changes to your Babel configuration file, restart your build process to see if the error has been resolved.