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.
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.
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.
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 |
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:
puppeteer-core
is one of the ingredients, and you want to postpone install.js
script execution until Chromium is about to be used.