I'm trying to follow the instructions here to bundle puppeteer, with the intention of including it in a chrome extension as a hacky way of scripting operations in the browser window (specifically, printing a page to PDF, which is surprisingly impossible with just the Chrome Extension API as far as I can tell).
As per the README
in the link above, I've set up my Chrome extension as follows:
background.html
<script src="./puppeteer/utils/browser/puppeteer-web.js"></script>
<script src="background.js"></script>
background.js
const puppeteer = require("puppeteer");
Throws the error puppeteer/utils/browser/puppeteer-web.js:10877 (anonymous function) Uncaught TypeError: Puppeteer is not a constructor
.
What am I missing here?
Chrome version: Version 69.0.3497.100
Node version: 7.4.0