I am trying to use esbuild with external react.
here is my esbuild command in my package.json file
  "scripts": {
    "esbuild": "esbuild ./src/index.js --bundle --outfile=dist/esmain.js --loader:.js=jsx --external:react-dom --external:react "
  }
when running the command, I get no errors:
npm run esbuild
> @1.0.0 esbuild C:\prog
> esbuild ./src/index.js --bundle --outfile=dist/esmain.js --loader:.js=jsx --external:react-dom --external:react
  dist\esmain.js  32.7kb
Done in 13ms
The problem is that when I run the program in the browser (chrome), I get this error in the console
Uncaught Error: Dynamic require of "react" is not supported
    at __require (esmain.js:12)
    at esmain.js:27
    at esmain.js:899
Any ideas how to fix this?