Skip to content
Advertisement

Run js or ts file with `bun js` in vscode’s code runner extension

How can I run .js or .ts file with bun in VS Code (from Code Runner Extension). I have only bun JS as JavaScript Runtime in my Computer ( I don’t have nodejs in my computer).

Even if I download nodejs then how can I run .js file with bun js in vscode code runner?

When I click run button in VS Code, it runs .js or .ts file with node. I don’t want to run .js file with nodejs or type bun run myFile.js in terminal.

I want to run the file with bun js with code runner extension as I do with nodejs.

I am aware of bun extension in vscode by pandy. But I want this with code runner extension button.

Advertisement

Answer

Adding

"code-runner.executorMap": {
    "javascript": "bun $fullFileName",
},

to your settings should make bun the default runner for javascript files.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement