fix: use require.resolve instead of __dirname (#8003)

This commit is contained in:
Alex Rudenko 2022-02-14 11:03:45 +01:00 committed by GitHub
parent f588c27db9
commit bbb186d88c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,11 +17,13 @@
import { PuppeteerNode } from './node/Puppeteer.js';
import { PUPPETEER_REVISIONS } from './revisions.js';
import { sync } from 'pkg-dir';
import { dirname } from 'path';
import { Product } from './common/Product.js';
export const initializePuppeteerNode = (packageName: string): PuppeteerNode => {
const puppeteerRootDirectory = sync(__dirname);
const puppeteerRootDirectory = sync(
dirname(require.resolve('./initialize-node'))
);
let preferredRevision = PUPPETEER_REVISIONS.chromium;
const isPuppeteerCore = packageName === 'puppeteer-core';
// puppeteer-core ignores environment variables