File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -3,21 +3,23 @@ import fs from 'fs'
3
3
import os from 'os'
4
4
import path from 'path'
5
5
import { Alert } from '@/infra/alert'
6
- // eslint-disable-next-line @typescript-eslint/no-require-imports
6
+ import { createRequire } from 'module'
7
+
8
+ const require = createRequire ( import . meta. url ) ;
7
9
const download : ( arg : Record < string , unknown > ) => Promise < string > = require ( 'download-chromium' )
8
10
9
11
export type ChromiumProviderFunc = ( ) => Promise < string | undefined >
10
12
11
13
const selectFromLocalTitle = '选择本地Chromium'
12
14
13
- const defaultChromiumPath = {
14
- osx : [ `${ os . homedir ( ) } /Applications/Google Chrome.app` , '/Applications/Google Chrome.app' ] ,
15
- win : [ 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe' ] ,
16
- }
17
-
18
15
const downloadFromInternetTitle = '帮我下载Chromium'
19
16
20
17
export class ChromiumPathProvider {
18
+ static defaultChromiumPath = {
19
+ osx : [ `${ os . homedir ( ) } /Applications/Google Chrome.app` , '/Applications/Google Chrome.app' ] ,
20
+ win : [ 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe' ] ,
21
+ }
22
+
21
23
static lookupExecutableFromMacApp = ( path ?: string ) => {
22
24
if ( path === undefined ) return
23
25
You can’t perform that action at this time.
0 commit comments