Commit b3860c0
committed
fix: auto-detect native binary distributor packages as externals
Packages like @secure-exec/v8 distribute platform-specific native
binaries via optionalDependencies (e.g. @secure-exec/v8-darwin-arm64).
These packages use createRequire(import.meta.url).resolve() at runtime
to locate the correct platform binary, which breaks when esbuild bundles
them because import.meta.url then points to the bundle output directory.
Add a heuristic to the auto-external detection that checks if a package
has optionalDependencies with platform-specific names (darwin, linux,
win32, etc.). When 2+ such deps are found, the package is marked as
external so it resolves binaries from its real node_modules location.
https://claude.ai/code/session_01ScLShmDQ92z8bY9A2T1cPB1 parent 2366b21 commit b3860c0
1 file changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
405 | 413 | | |
406 | 414 | | |
407 | 415 | | |
| |||
655 | 663 | | |
656 | 664 | | |
657 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
0 commit comments