How Bun supports V8 APIs without using V8 (part 1) | Bun Blog

16-Oct-2024 221
When packages work in Node.js but don't work in Bun, we consider that a bug in Bun. Native C & C++ APIs are often used in the JavaScript ecosystem for performance-critical libraries like 2D Canvas, database drivers, CPU detection, and more. Bun and Node.js implement Node-API (napi), which is the recommended engine-independent C API for interfacing with JavaScript. But, a number of popular native modules directly use the V8 engine APIs exposed by Node.js. At the time of writing, the issue requesting V8 API support is the 11th-highest open issue on Bun's tracker when sorted by thumbs-up. This is challenging for Bun because we use JavaScriptCore as the JavaScript engine (used in Safari), unlike Node.js which uses V8 (used in Chrome). JavaScriptCore is an entirely different JavaScript engine implementation with different design choices.
Use coupon code:

JAVASCRIPT

to get 40% discount on our 'The JavaScript Interview Bible' book!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle