ITADN

ESM dual package export (9cf1a34) breaks bundling

#3172Openartemtam 创建于 2026-02-09
Category: Bug
A
artemtamcommented
### 🐛 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 条评论