ink icon indicating copy to clipboard operation
ink copied to clipboard

Can run examples with esm + esbuild

Open Trenrod opened this issue 1 month ago • 0 comments

Is esbuild with esm supported?

package.json

{
	"type": "module",
	"dependencies": {
		"ink": "^6.4.0",
		"react": "^19.2.0"
	},
	"devDependencies": {
		"@types/react": "^19.2.2"
	}
}

Build without react-devtools-core

  • esbuild index.ts --bundle --platform=node --format=esm --external:react-devtools-core --outfile=dist/cli.js
  • DEV=false node dist/cli.js

Results in

Waiting for the debugger to disconnect...
/home/ado/dev/reacttui/node_modules/react-devtools-core/dist/backend.js:10
})(self, () => {
   ^

ReferenceError: self is not defined
    at Object.<anonymous> (/home/ado/dev/reacttui/node_modules/react-devtools-core/dist/backend.js:10:4)

Build with react-devtools-core

  • esbuild index.ts --bundle --platform=node --format=esm --outfile=dist/cli.js
  • DEV=false node dist/cli.js
file:///home/ado/dev/reacttui/dist/cli.js:11
  throw Error('Dynamic require of "' + x + '" is not supported');
        ^

Error: Dynamic require of "assert" is not supported
    at file:///home/ado/dev/reacttui/dist/cli.js:11:9

Trenrod avatar Nov 01 '25 09:11 Trenrod