ESM dual package export (9cf1a34) breaks bundling
Category: Bug
### 🐛 Bug report
`createRequire` in ESM build breaks bundling (9cf1a34). I tested with Bun and Rolldown (with node). Both can not properly resolve imported files which result in "Cannot find module" error.
```
node:internal/modules/cjs/loader:1453
const err = new Error(message);
^
Error: Cannot find module '../package.json'
```
### To reproduce
Create a `repro.js` with a single import:
```js
import { Client } from '@elastic/elasticsearch';
```
Compile it with Bun or Rolldown:
```shell
bun build --target bun ./repro.js --outfile ./bundled.js
# or
npx rolldown --platform node ./repro.js > ./bundled.js
```
Run it:
```
bun ./bundled.js
# or
node ./bundled.js
```
Observe "Cannot find module" error.
### Expected behavior
It should work: bundlers should be able to analyze & resolve imported modules.
### Node.js version
v25.6.0
### @elastic/elasticsearch version
9.3.0
### Operating system
MacOS Tahoe 26.2 (ARM64)
### Any other relevant environment information
_No response_
0 条评论