Skip to content

Commit fc70940

Browse files
authored
build(vite): emit powerpoint-bridge.ps1 into out/main (#62)
The viteStaticCopy target for the PowerShell bridge had stopped emitting anything. Two independent faults, each producing the same silent no-op: 1. vite-plugin-static-copy v4 added an `environment` option defaulting to `client`, and its build plugin returns early when the name does not match. electron-vite builds the main process in Vite's `ssr` environment, so the writeBundle hook never ran and no copy line was logged. The target was added in 38de84e against ^3.1.4 and broke on the bump to ^4.1.1. 2. `dest` reproduces the matched path's directory segments underneath itself, so even once the hook ran the file landed in out/main/src/main/pptx/ rather than out/main/. `rename: { stripBase: true }` flattens it. This matters because src/main/pptx/windows-powershell.ts walks a list of candidate paths for the bridge, and its `path.join(__dirname, ...)` entry points at out/main/. That candidate has been dead since the bump, so dev and `electron-vite preview` runs on Windows were falling through to the `src/main/pptx/...` relative candidates, which resolve only by accident of the working directory. Packaged builds were never affected - they resolve via process.resourcesPath, populated from build.extraResources - which is why this is fixed rather than deleted. Also removes forge.config.ts. Every packaging script invokes electron-builder and release.yml calls dist:mac / dist:win, so it described a setup the project does not use. It was inert rather than merely redundant: no @electron-forge/* package appears in package-lock.json, so its imports were unresolvable, and tsconfig.json includes only src/**/*, so typecheck never read it. A leftover of TODO.md's "Phase 11: Packaging", which specified Forge before the project settled on electron-builder. The bridge now also ships in the npm tarball, consistent with the `out/**` allowlist added in #59.
1 parent 9e77f3b commit fc70940

2 files changed

Lines changed: 14 additions & 44 deletions

File tree

‎electron.vite.config.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,23 @@ export default defineConfig({
1010
plugins: [
1111
externalizeDepsPlugin(),
1212
viteStaticCopy({
13+
// electron-vite builds the main process in Vite's `ssr` environment, but
14+
// vite-plugin-static-copy v4 gained an `environment` option that defaults
15+
// to `client` and silently no-ops its writeBundle hook everywhere else.
16+
// Without this the target never fired and out/main/powerpoint-bridge.ps1
17+
// was never emitted, leaving the __dirname lookup in
18+
// src/main/pptx/windows-powershell.ts resolving against a file that did
19+
// not exist.
20+
environment: 'ssr',
1321
targets: [
1422
{
1523
src: 'src/main/pptx/powerpoint-bridge.ps1',
16-
dest: '.'
24+
// `dest` alone reproduces the matched path's directories underneath
25+
// it, which would land the script in out/main/src/main/pptx/. The
26+
// __dirname lookup expects it flat next to index.js, so strip the
27+
// leading segments.
28+
dest: '.',
29+
rename: { stripBase: true }
1730
}
1831
]
1932
})

‎forge.config.ts‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)