Build System Overview

    The following gn files contain the main rules for building Electron:

    • BUILD.gn defines how Electron itself is built and includes the default configurations for linking with Chromium.
    • build/args/{debug,release,all}.gn contain the default build arguments for building Electron.

    Since Chromium is quite a large project, the final linking stage can take quite a few minutes, which makes it hard for development. In order to solve this, Chromium introduced the “component build”, which builds each component as a separate shared library, making linking very quick but sacrificing file size and performance.

    Electron inherits this build option from Chromium. In builds, the binary will be linked to a shared library version of Chromium’s components to achieve fast linking time; for Release builds, the binary will be linked to the static library versions, so we can have the best possible binary size and performance.

    Test your changes conform to the project coding style using:

    Test functionality using:

      Whenever you make changes to Electron source code, you’ll need to re-run the build before the tests:

      1. describe.only('some feature', () => {
      2. // ... only tests in this block will be run

      Alternatively, you can use mocha’s grep option to only run tests matching the given regular expression pattern:

      Tests that include native modules (e.g. ) can’t be executed with the debug build (see #2558 for details), but they will work with the release build.

      To run the tests with the release build use:

      1. $ npm test -- -R