summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/compat/cjs/compat.ts
blob: 782727e00e9ffe9262f179a5d59493aae20f3ec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import {dirname} from 'path';

/**
 * @internal
 */
let puppeteerDirname: string;

try {
  // In some environments, like esbuild, this will throw an error.
  // We suppress the error since the bundled binary is not expected
  // to be used or installed in this case and, therefore, the
  // root directory does not have to be known.
  puppeteerDirname = dirname(require.resolve('./compat'));
} catch (error) {
  // Fallback to __dirname.
  puppeteerDirname = __dirname;
}

export {puppeteerDirname};