Fix puppeteer import (#145)

TypeError: Cannot read property '_launcher' of undefined
This commit is contained in:
Steven 2021-01-09 16:28:05 -05:00 committed by GitHub
parent f7961ce7a4
commit 7d879675da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1,14 +1,14 @@
import { launch, Page } from 'puppeteer-core';
import core from 'puppeteer-core';
import { getOptions } from './options';
import { FileType } from './types';
let _page: Page | null;
let _page: core.Page | null;
async function getPage(isDev: boolean) {
if (_page) {
return _page;
}
const options = await getOptions(isDev);
const browser = await launch(options);
const browser = await core.launch(options);
_page = await browser.newPage();
return _page;
}