mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Fixes Next.js 16 + React Compiler build failure when using Bun runtime.
## Issue
When `Module._resolveFilename` was overridden (e.g., by Next.js's
require-hook), Bun was not passing the `options` parameter (which
contains `paths`) to the override function. This caused resolution
failures when the override tried to use custom resolution paths.
Additionally, when `Module._resolveFilename` was called directly with
`options.paths`, Bun was ignoring the paths parameter and using default
resolution.
## Root Causes
1. In `ImportMetaObject.cpp`, when calling an overridden
`_resolveFilename` function, the options object with paths was not being
passed as the 4th argument.
2. In `NodeModuleModule.cpp`, `jsFunctionResolveFileName` was calling
`Bun__resolveSync` without extracting and using the `options.paths`
parameter.
## Solution
1. In `ImportMetaObject.cpp`: When `userPathList` is provided, construct
an options object with `{paths: userPathList}` and pass it as the 4th
argument to the overridden `_resolveFilename` function.
2. In `NodeModuleModule.cpp`: Extract `options.paths` from the 4th
argument and call `Bun__resolveSyncWithPaths` when paths are provided,
instead of always using `Bun__resolveSync`.
## Reproduction
Before this fix, running:
```bash
bun --bun next build --turbopack
```
on a Next.js 16 app with React Compiler enabled would fail with:
```
Cannot find module './node_modules/babel-plugin-react-compiler'
```
## Testing
- Added comprehensive tests for `Module._resolveFilename` with
`options.paths`
- Verified Next.js 16 + React Compiler + Turbopack builds successfully
with Bun
- All 5 new tests pass with the fix, 3 fail without it
- All existing tests continue to pass
## Files Changed
- `src/bun.js/bindings/ImportMetaObject.cpp` - Pass options to override
- `src/bun.js/modules/NodeModuleModule.cpp` - Handle options.paths in
_resolveFilename
- `test/js/node/module/module-resolve-filename-paths.test.js` - New test
suite
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
152 lines
7.9 KiB
Plaintext
152 lines
7.9 KiB
Plaintext
# List of tests for which we do NOT set validateExceptionChecks=1 when running in ASAN CI
|
|
|
|
# List of tests that potentially throw inside of reifyStaticProperties
|
|
test/js/node/test/parallel/test-stream-some-find-every.mjs
|
|
test/js/node/test/parallel/test-stream-iterator-helpers-test262-tests.mjs
|
|
test/js/node/test/parallel/test-fs-stat-date.mjs
|
|
test/js/node/test/parallel/test-fs-readSync-position-validation.mjs
|
|
test/js/node/test/parallel/test-fs-read-promises-position-validation.mjs
|
|
test/js/node/test/parallel/test-fs-read-position-validation.mjs
|
|
test/js/node/test/parallel/test-net-server-async-dispose.mjs
|
|
test/js/node/test/parallel/test-net-connect-custom-lookup-non-string-address.mjs
|
|
test/js/node/test/parallel/test-abortsignal-any.mjs
|
|
test/js/node/test/parallel/test-child-process-fork-url.mjs
|
|
test/js/node/test/parallel/test-debugger-invalid-json.mjs
|
|
test/js/node/test/parallel/test-dgram-async-dispose.mjs
|
|
test/js/node/test/parallel/test-events-add-abort-listener.mjs
|
|
test/js/node/test/parallel/test-fetch.mjs
|
|
test/js/node/test/parallel/test-module-globalpaths-nodepath.js
|
|
test/js/node/test/parallel/test-parse-args.mjs
|
|
test/js/node/test/parallel/test-process-default.js
|
|
test/js/node/test/parallel/test-readline-promises-csi.mjs
|
|
test/js/node/test/parallel/test-require-dot.js
|
|
test/js/node/test/parallel/test-util-promisify-custom-names.mjs
|
|
test/js/node/test/parallel/test-whatwg-readablestream.mjs
|
|
test/js/node/test/parallel/test-worker.mjs
|
|
test/js/node/test/system-ca/test-native-root-certs.test.mjs
|
|
test/js/node/events/event-emitter.test.ts
|
|
test/js/node/module/node-module-module.test.js
|
|
test/js/node/module/module-resolve-filename-paths.test.js
|
|
test/js/node/process/call-constructor.test.js
|
|
test/js/node/stubs.test.js
|
|
test/js/node/timers/node-timers.test.ts
|
|
test/bake/dev/vfile.test.ts
|
|
test/bake/dev/import-meta-inline.test.ts
|
|
test/bake/dev/production.test.ts
|
|
test/cli/run/run-eval.test.ts
|
|
test/cli/run/self-reference.test.ts
|
|
test/js/bun/resolve/import-meta-resolve.test.mjs
|
|
test/js/bun/resolve/import-meta.test.js
|
|
test/js/bun/util/BunObject.test.ts
|
|
test/js/bun/util/fuzzy-wuzzy.test.ts
|
|
test/js/third_party/pg-gateway/pglite.test.ts
|
|
test/js/web/websocket/websocket.test.js
|
|
test/js/node/test/parallel/test-vm-module-referrer-realm.mjs
|
|
test/js/bun/resolve/resolve.test.ts
|
|
test/cli/install/bunx.test.ts
|
|
test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
|
|
test/integration/vite-build/vite-build.test.ts
|
|
test/bundler/esbuild/default.test.ts
|
|
test/cli/install/bun-repl.test.ts
|
|
test/js/third_party/astro/astro-post.test.js
|
|
test/regression/issue/ctrl-c.test.ts
|
|
test/bundler/bundler_comments.test.ts
|
|
test/js/node/test/parallel/test-fs-promises-file-handle-readLines.mjs
|
|
|
|
# trips asan on my macos test machine
|
|
test/js/node/test/parallel/test-fs-watch.js
|
|
test/js/node/test/parallel/test-fs-watch-recursive-watch-file.js
|
|
# hit a debug assert
|
|
test/bundler/bundler_compile.test.ts
|
|
|
|
# try again later
|
|
test/js/node/test/parallel/test-worker-nested-uncaught.js
|
|
|
|
# 3rd party napi
|
|
test/integration/sharp/sharp.test.ts
|
|
test/js/third_party/@duckdb/node-api/duckdb.test.ts
|
|
test/js/third_party/@napi-rs/canvas/napi-rs-canvas.test.ts
|
|
test/js/third_party/duckdb/duckdb-basic-usage.test.ts
|
|
test/js/third_party/prisma/prisma.test.ts
|
|
test/js/third_party/remix/remix.test.ts
|
|
test/js/third_party/resvg/bbox.test.js
|
|
test/js/third_party/rollup-v4/rollup-v4.test.ts
|
|
test/napi/uv.test.ts
|
|
test/napi/uv_stub.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/2_function_arguments/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/3_callbacks/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/4_object_factory/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/5_function_factory/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/6_object_wrap/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/7_factory_wrap/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/8_passing_wrapped/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_array/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_bigint/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_cannot_run_js/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_constructor/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_conversions/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_dataview/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_date/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_error/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_exception/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_finalizer/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_function/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_general/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_handle_scope/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_instance_data/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_new_target/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_number/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_object/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_promise/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_properties/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_reference/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_reference_double_free/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_string/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_symbol/do.test.ts
|
|
test/napi/node-napi-tests/test/js-native-api/test_typedarray/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/1_hello_world/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_async/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_buffer/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_callback_scope/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_cleanup_hook/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_exception/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_fatal/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_fatal_exception/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_general/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_init_order/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_instance_data/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_make_callback/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_make_callback_recurse/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_threadsafe_function/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_worker_terminate_finalization/do.test.ts
|
|
test/napi/node-napi-tests/test/node-api/test_reference_by_node_api_version/do.test.ts
|
|
|
|
# normalizeCryptoAlgorithmParameters
|
|
test/js/node/test/parallel/test-webcrypto-derivekey.js
|
|
test/js/node/test/parallel/test-webcrypto-digest.js
|
|
test/js/node/test/parallel/test-webcrypto-encrypt-decrypt-aes.js
|
|
test/js/bun/crypto/wpt-webcrypto.generateKey.test.ts
|
|
test/js/node/test/parallel/test-webcrypto-encrypt-decrypt.js
|
|
test/js/node/test/parallel/test-webcrypto-sign-verify.js
|
|
test/js/node/test/parallel/test-webcrypto-cryptokey-workers.js
|
|
test/js/node/test/parallel/test-crypto-oaep-zero-length.js
|
|
test/js/node/test/parallel/test-crypto-psychic-signatures.js
|
|
test/js/node/test/parallel/test-crypto-subtle-zero-length.js
|
|
test/js/node/test/parallel/test-crypto-worker-thread.js
|
|
test/js/node/test/parallel/test-crypto-webcrypto-aes-decrypt-tag-too-small.js
|
|
test/js/web/crypto/web-crypto.test.ts
|
|
test/js/node/crypto/node-crypto.test.js
|
|
test/js/third_party/pg/pg.test.ts
|
|
test/regression/issue/01466.test.ts
|
|
test/regression/issue/21311.test.ts
|
|
test/js/deno/crypto/webcrypto.test.ts
|
|
vendor/elysia/test/aot/response.test.ts
|
|
vendor/elysia/test/cookie/response.test.ts
|
|
vendor/elysia/test/cookie/signature.test.ts
|
|
vendor/elysia/test/core/dynamic.test.ts
|
|
vendor/elysia/test/lifecycle/error.test.ts
|
|
vendor/elysia/test/validator/body.test.ts
|
|
vendor/elysia/test/ws/message.test.ts
|
|
|
|
test/js/node/test/parallel/test-worker-abort-on-uncaught-exception.js
|