oven-sh / bun

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

Run script without extension #3824

Open zakhaev26 opened 1 year ago

zakhaev26 commented 1 year ago

What is the problem this feature would solve?

When using the Bun runtime environment as a substitute for Node.js, there is an unexpected requirement to include the ".js" file extension when running a JavaScript file. This contrasts with Node.js, where we can directly execute a JavaScript file without specifying the ".js" extension.

For example : node app.js as well as node app works but for bun,only bun app.js is the only way

What is the feature you are proposing to solve the problem?

The requirement to explicitly include the ".js" extension when executing JavaScript files in the "bun" runtime environment can be cumbersome and deviates from the user experience provided by Node.js. Users may expect similar behavior in both environments, making it difficult to transition between the two. It is suggested to consider adopting a similar behavior to Node.js for file execution, allowing users to run JavaScript files directly without the need for the ".js" extension in "bun". This change would improve developer experience.

What alternatives have you considered?

No response

VyacheslavPritykin commented 10 months ago

I tried to set up Angular tests in JetBrains Rider using bun, but it seems impossible at the moment because bun requires file extension to be specified, which is under the Rider's control:

image