Puppeteer vs. puppeteer-core

Since the release of Puppeteer v1.7.0, we’ve had the option between two packages: puppeteer and puppeteer-core. In this shot, we will cover the key differences between these two packages.

Puppeteer is a Node library that provides a high-level API to control headless Chrome or Chromium browsers over the DevTools Protocol. Read more on it here.

About puppeteer

The puppeteer package is the complete product. The package is bundled with a Chromium browser that drives the puppeteer-core. This bundled browser makes the download size quite large. Being an end-user product, puppeteer supports many convenient PUPPETEER_* env variables to tweak its behavior.

About puppeteer-core

puppeteer-core is a library that helps drive anything that supports DevTools protocol. The package is a lightweight version of Puppeteer that can launch an existing browser installation or connect to a remote one. It does not download any browser by default. Being a library, puppeteer-core is entirely driven through its programmatic interface and disregards all the PUPPETEER_* env variables.

puppeteer vs. puppeteer-core

In summary, the key differences are:

puppeteer puppeteer-core
Downloads a Chromium browser by default. Does not automatically download a browser.
Works with PUPPETEER_* env variables. Ignores all PUPPETEER_* env variables.
npm i puppeteer npm i puppeteer-core

Which one is right for me?

In most cases, you’ll be fine using the puppeteer package. The browser bundled with puppeteer is guaranteed to work with the API, so you can quickly get started writing code for browser automation.

However, you might want to use puppeteer-core if:

  • You’re building another end-user product or library atop of DevTools protocol.
  • You’re bundling Puppeteer to use in Chrome Extension/browser with the DevTools protocol, where downloading an additional Chromium binary is unnecessary.
  • You’re building a set of tools where puppeteer-core is one of the ingredients, and you want to postpone install.js script execution until Chromium is about to be used.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved