fix(core): update
This commit is contained in:
28
ts/index.ts
28
ts/index.ts
@@ -1,25 +1,9 @@
|
||||
import puppeteer from 'puppeteer';
|
||||
// module exports
|
||||
|
||||
export interface IEnvAwareOptions {
|
||||
forceNoSandbox?: boolean;
|
||||
}
|
||||
|
||||
export const getEnvAwareBrowserInstance = async (optionsArg: IEnvAwareOptions = {}): Promise<puppeteer.Browser> => {
|
||||
const options: IEnvAwareOptions = {
|
||||
...{
|
||||
forceNoSandbox: false
|
||||
},
|
||||
...optionsArg
|
||||
}
|
||||
|
||||
let chromeArgs: string[] = [];
|
||||
if (process.env.CI || options.forceNoSandbox) {
|
||||
chromeArgs = chromeArgs.concat(['--no-sandbox', '--disable-setuid-sandbox']);
|
||||
}
|
||||
const headlessBrowser = await puppeteer.launch({
|
||||
args: chromeArgs
|
||||
});
|
||||
return headlessBrowser;
|
||||
};
|
||||
export * from './smartpuppeteer.classes.smartpuppeteer';
|
||||
|
||||
// direct exports
|
||||
import { puppeteer } from './smartpuppeteer.plugins';
|
||||
export { puppeteer };
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user