mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-07 00:17:17 +08:00
make find-chrome-bin as external dependencies to resolve production build runtime error
This commit is contained in:
@@ -9,7 +9,7 @@ export default defineConfig({
|
|||||||
main: {
|
main: {
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ['puppeteer', 'puppeteer-extra', 'puppeteer-extra-plugin-stealth', '@puppeteer/browsers']
|
external: ['puppeteer', 'puppeteer-extra', 'puppeteer-extra-plugin-stealth', '@puppeteer/browsers', 'find-chrome-bin']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
Object.assign(module.exports, {
|
Object.assign(module.exports, {
|
||||||
puppeteerExtra: require('puppeteer-extra'),
|
puppeteerExtra: require('puppeteer-extra'),
|
||||||
PuppeteerExtraPluginStealth: require('puppeteer-extra-plugin-stealth'),
|
PuppeteerExtraPluginStealth: require('puppeteer-extra-plugin-stealth'),
|
||||||
puppeteerManager: require('@puppeteer/browsers')
|
puppeteerManager: require('@puppeteer/browsers'),
|
||||||
|
findChromeBin: require('find-chrome-bin')
|
||||||
})
|
})
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export * as puppeteerExtra from 'puppeteer-extra'
|
export * as puppeteerExtra from 'puppeteer-extra'
|
||||||
export * as PuppeteerExtraPluginStealth from 'puppeteer-extra-plugin-stealth'
|
export * as PuppeteerExtraPluginStealth from 'puppeteer-extra-plugin-stealth'
|
||||||
export * as puppeteerManager from '@puppeteer/browsers'
|
export * as puppeteerManager from '@puppeteer/browsers'
|
||||||
|
export * as findChromeBin from 'find-chrome-bin'
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@puppeteer/browsers": "^2.0.0",
|
"@puppeteer/browsers": "^2.0.0",
|
||||||
|
"find-chrome-bin": "^2.0.1",
|
||||||
"puppeteer": "^22.0.0",
|
"puppeteer": "^22.0.0",
|
||||||
"puppeteer-extra": "^3.3.6",
|
"puppeteer-extra": "^3.3.6",
|
||||||
"puppeteer-extra-plugin-stealth": "^2.11.2"
|
"puppeteer-extra-plugin-stealth": "^2.11.2"
|
||||||
@@ -497,6 +498,37 @@
|
|||||||
"pend": "~1.2.0"
|
"pend": "~1.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/find-chrome-bin": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/find-chrome-bin/-/find-chrome-bin-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-aDwC2y0dLxt0GFmQ+q8bqBCZ10VW9zYT/lNV806tRDqDAh5XpkTWulB96RKDHDuKu36m/dEvhmhD5IU237oOTg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@puppeteer/browsers": "^1.8.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/find-chrome-bin/node_modules/@puppeteer/browsers": {
|
||||||
|
"version": "1.9.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@puppeteer/browsers/-/browsers-1.9.1.tgz",
|
||||||
|
"integrity": "sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "4.3.4",
|
||||||
|
"extract-zip": "2.0.1",
|
||||||
|
"progress": "2.0.3",
|
||||||
|
"proxy-agent": "6.3.1",
|
||||||
|
"tar-fs": "3.0.4",
|
||||||
|
"unbzip2-stream": "1.4.3",
|
||||||
|
"yargs": "17.7.2"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"browsers": "lib/cjs/main-cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/for-in": {
|
"node_modules/for-in": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmmirror.com/for-in/-/for-in-1.0.2.tgz",
|
"resolved": "https://registry.npmmirror.com/for-in/-/for-in-1.0.2.tgz",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@puppeteer/browsers": "^2.0.0",
|
"@puppeteer/browsers": "^2.0.0",
|
||||||
|
"find-chrome-bin": "^2.0.1",
|
||||||
"puppeteer": "^22.0.0",
|
"puppeteer": "^22.0.0",
|
||||||
"puppeteer-extra": "^3.3.6",
|
"puppeteer-extra": "^3.3.6",
|
||||||
"puppeteer-extra-plugin-stealth": "^2.11.2"
|
"puppeteer-extra-plugin-stealth": "^2.11.2"
|
||||||
|
|||||||
+17
-1
@@ -1,7 +1,23 @@
|
|||||||
import { findChrome } from "find-chrome-bin";
|
import { is } from '@electron-toolkit/utils'
|
||||||
|
import electron from 'electron'
|
||||||
import * as os from 'node:os'
|
import * as os from 'node:os'
|
||||||
|
import path from 'node:path'
|
||||||
|
|
||||||
export default async function findAndLocateExistedChromiumExecutable() {
|
export default async function findAndLocateExistedChromiumExecutable() {
|
||||||
|
let findChrome: typeof import('find-chrome-bin').findChrome
|
||||||
|
if (is.dev) {
|
||||||
|
findChrome = (await import('find-chrome-bin')).findChrome
|
||||||
|
} else {
|
||||||
|
findChrome = (
|
||||||
|
await import(
|
||||||
|
path.resolve(
|
||||||
|
electron.app.getAppPath(),
|
||||||
|
'..',
|
||||||
|
'external-node-runtime-dependencies/index.mjs'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).findChromeBin.findChrome
|
||||||
|
}
|
||||||
// For windows, try to find Edge(chromium)
|
// For windows, try to find Edge(chromium)
|
||||||
if (os.platform() === 'win32') {
|
if (os.platform() === 'win32') {
|
||||||
// TODO: handle windows
|
// TODO: handle windows
|
||||||
|
|||||||
Reference in New Issue
Block a user