chore: upgrade puppeteer usage to fit new version
This commit is contained in:
parent
f59793d6f1
commit
13227416c0
@ -1,13 +1,18 @@
|
|||||||
import puppeteer from 'puppeteer';
|
import puppeteer from 'puppeteer';
|
||||||
import lighthouse, { Result, generateReport } from 'lighthouse';
|
import lighthouse, { Result, generateReport } from 'lighthouse';
|
||||||
|
import { logger } from '../logger.js';
|
||||||
|
import { env } from '../env.js';
|
||||||
|
|
||||||
export async function generateLighthouse(url: string): Promise<Result> {
|
export async function generateLighthouse(url: string): Promise<Result> {
|
||||||
|
logger.info('[Lighthouse] Generating Lighthouse report...', { url });
|
||||||
|
|
||||||
// Use Puppeteer to launch headless Chrome
|
// Use Puppeteer to launch headless Chrome
|
||||||
// - Omit `--enable-automation` (See https://github.com/GoogleChrome/lighthouse/issues/12988)
|
// - Omit `--enable-automation` (See https://github.com/GoogleChrome/lighthouse/issues/12988)
|
||||||
// - Don't use 800x600 default viewport
|
// - Don't use 800x600 default viewport
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
// Set to false if you want to see the script in action.
|
// Set to false if you want to see the script in action.
|
||||||
headless: 'new',
|
executablePath: env.puppeteerExecutablePath,
|
||||||
|
headless: true,
|
||||||
args: ['--no-sandbox', '--single-process', '--disable-dev-shm-usage'],
|
args: ['--no-sandbox', '--single-process', '--disable-dev-shm-usage'],
|
||||||
defaultViewport: null,
|
defaultViewport: null,
|
||||||
ignoreDefaultArgs: ['--enable-automation'],
|
ignoreDefaultArgs: ['--enable-automation'],
|
||||||
|
@ -12,7 +12,7 @@ export async function screenshotWebsiteDetailImage(
|
|||||||
) {
|
) {
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
executablePath: env.puppeteerExecutablePath,
|
executablePath: env.puppeteerExecutablePath,
|
||||||
headless: 'new',
|
headless: true,
|
||||||
});
|
});
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user