oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.29k stars 2.77k forks source link

bun does not read jsconfig/tsconfig when running a file without .js or .ts extensions #11395

Open adhusson opened 5 months ago

adhusson commented 5 months ago

What version of Bun is running?

1.1.10+5102a9443

What platform is your computer?

Darwin 23.5.0 arm64 arm

What steps can reproduce the bug?

  1. Create the following files:

    • cli-tool
    #!/usr/bin/env bun
    import log from 'dir/file'
    log()
    • jsconfig.json

      {
      "compilerOptions": {
      "baseUrl": "."
      }
      }
    • dir/file.js

      export default () => { console.log("Success");}
  2. chmod +x cli-tool

  3. Run ./cli-tool

  4. mv cli-tool cli-tool.js

  5. Run ./cli-tool.js

What is the expected behavior?

Running ./cli-tool{,.js} should result in Success

What do you see instead?

  1. ./cli-tool results in error: Cannot find module "dir/file" ...
  2. ./cli-tool.js results in Success

Additional information

No response

undeadevs commented 1 month ago

+1