How build react app es module with rollup.js

I try add ipfs in my react project
git: GitHub - zababurinsv/React-test
index.js

import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
const container = document.querySelector('#root');

export default () => {
    const root = createRoot(container);
    root.render(<App tab="home" />);
}

My app.js

import React from 'react';
import logo from './logo.svg';
import './App.css';
import * as IPFS from 'ipfs'

function App() {
  console.log('----------------------------', IPFS)
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;


rollup.js config

import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";
import babel from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import image from '@rollup/plugin-image';
import postcss from 'rollup-plugin-postcss';
import json from '@rollup/plugin-json';
import webWorkerLoader from 'rollup-plugin-web-worker-loader';
import nodePolyfills from 'rollup-plugin-polyfill-node';
const extensions = ['.js','.mjs', '.ts', '.tsx'];

export default {
    input: "src/index.js",
    output: {
        file: "modules/index.mjs",
        format: "es",
        sourcemap: true,
    },
    plugins: [
        image(),
        json(),
        webWorkerLoader(),
        postcss({
            extensions: [".css"],
            plugins: [
            ]
        }),
        replace({
            preventAssignment: true,
            'process.env.NODE_ENV': JSON.stringify( 'development' )
        }),
        babel({
            extensions,
            exclude: /node_modules/,
            babelrc: false,
            babelHelpers: 'runtime',
            presets: [
                '@babel/preset-env',
                '@babel/preset-react',
                '@babel/preset-typescript',
            ],
            plugins: [
                'react-require',
                '@babel/plugin-syntax-dynamic-import',
                '@babel/plugin-proposal-class-properties',
                ['@babel/plugin-proposal-object-rest-spread', {
                    useBuiltIns: true,
                }],
                ['@babel/plugin-transform-runtime', {
                    corejs: 3,
                    helpers: true,
                    regenerator: true,
                    useESModules: true,
                }],
            ],
        }),
        nodePolyfills(),
        nodeResolve(),
        commonjs( {
            include: /node_modules/
        }),
        serve({
            open: false,
            verbose: true,
            contentBase: [""],
            host: "localhost",
            port: 3012,
        }),
        livereload({ watch: "dist" }),
    ]
};

I am getting an error on build.

[!] (plugin commonjs--resolver) SyntaxError: Unexpected token (13:121) in /home/sergey/Desktop/newkind/inProgerss/react-rollup-starter/node_modules/ipfs-utils/src/env.js
node_modules/ipfs-utils/src/env.js (13:121)
11: // @ts-ignore - we either ignore worker scope or dom scope
12: const IS_WEBWORKER = typeof importScripts === 'function' && typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope
13: const IS_TEST = typeof globalThis.process !== 'undefined' && typeof globalThis.process.env !== 'undefined' && globalThis.process.env.NODE_ENV === 'test'
                                                                                                                             ^
14: const IS_REACT_NATIVE = typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
SyntaxError: Unexpected token (13:121) in /home/sergey/Desktop/newkind/inProgerss/react-rollup-starter/node_modules/ipfs-utils/src/env.js

Tell me please. Where can I find the answer, how to fix it?