fix(desktop): skip obfuscation for electron main to preserve page.evaluate
Playwright serializes page.evaluate callbacks via Function.prototype.toString and runs them in the target page context. Obfuscating the main bundle injected string-array helper references that the browser page could not resolve, surfacing as `ReferenceError: wO is not defined` for bilibili and dongchedi publishes. Mirrors the existing Vite `minify: false` guard for main/preload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,12 +42,12 @@ const baseOptions = {
|
||||
}
|
||||
|
||||
const targets = [
|
||||
{
|
||||
label: 'main',
|
||||
dir: path.join(outDir, 'main'),
|
||||
match: (name) => name.endsWith('.cjs'),
|
||||
options: { ...baseOptions, target: 'node' },
|
||||
},
|
||||
// Keep the Electron main process unobfuscated. It owns the Playwright
|
||||
// adapters, and Playwright serializes `page.evaluate` callbacks with
|
||||
// Function.prototype.toString(). Obfuscator string-array helpers live in the
|
||||
// main bundle, not in the target web page, so packaged media publishers such
|
||||
// as bilibili and dongchedi can fail with "ReferenceError: <helper> is not
|
||||
// defined" inside the browser context.
|
||||
{
|
||||
label: 'renderer',
|
||||
dir: path.join(outDir, 'renderer', 'assets'),
|
||||
|
||||
Reference in New Issue
Block a user