Enable Experimental JS and CSS Features in Electron

May 21, 2022

Enable Experimental JS and CSS Features in Electron

Electron uses the Chromium engine for rendering. This is the same engine that powers the Chrome browser.

Sometimes you might run into a situation where a certain JavaScript or CSS feature that your browser clearly supports does not seem to work with Electron.

A good example is aspect-ratio which is not supported by Electron 11 which runs a version of Chromium < v88. Chrome added this feature in v88.

You can use this technique for any such feature. Here's how I enabled aspect-ratio for an Electron 11 project.

In the Electron main process entry file (src/index.js in my case) add this line before app.whenReady().


app.whenReady().then(() => {
Liked this article? Share it on your favorite platform.
Picture of me