We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0d4b54 commit 09b85e1Copy full SHA for 09b85e1
1 file changed
api/_lib/options.ts
@@ -0,0 +1,30 @@
1
+import chrome from 'chrome-aws-lambda';
2
+const exePath = process.platform === 'win32'
3
+? 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
4
+: process.platform === 'linux'
5
+? '/usr/bin/google-chrome'
6
+: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
7
+
8
+interface Options {
9
+ args: string[];
10
+ executablePath: string;
11
+ headless: boolean;
12
+}
13
14
+export async function getOptions(isDev: boolean) {
15
+ let options: Options;
16
+ if (isDev) {
17
+ options = {
18
+ args: [],
19
+ executablePath: exePath,
20
+ headless: true
21
+ };
22
+ } else {
23
24
+ args: chrome.args,
25
+ executablePath: await chrome.executablePath,
26
+ headless: chrome.headless,
27
28
+ }
29
+ return options;
30
0 commit comments