File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 "scripts" : {
3131 "postinstall" : " electron-rebuild -f || echo 'Warning: native module rebuild failed — terminal/serial/SSH may not work'" ,
3232 "rebuild-native" : " electron-rebuild -f" ,
33- "build" : " tsc --noEmit && tsc && npm run copy-assets" ,
33+ "build" : " tsc --noEmit && tsc && node scripts/build-renderer.js && npm run copy-assets" ,
3434 "copy-assets" : " node scripts/copy-assets.js" ,
3535 "start" : " npm run build && electron . --no-sandbox" ,
3636 "dev" : " npm run build && electron . --no-sandbox" ,
6262 "@types/ssh2" : " ^1.15.5" ,
6363 "electron" : " ^28.0.0" ,
6464 "electron-builder" : " ^24.9.1" ,
65+ "esbuild" : " ^0.27.2" ,
6566 "typescript" : " ^5.3.0" ,
6667 "vitest" : " ^4.0.18"
6768 },
Original file line number Diff line number Diff line change 1+ // Bundles the renderer entry (src/renderer/renderer.ts) into a single
2+ // dist/renderer/renderer.js via esbuild.
3+ //
4+ // LOGAN v2 Phase 0 (issue #15): the renderer is being split into ES modules. tsc
5+ // (CommonJS) can't emit browser-loadable modules, so esbuild bundles them into one
6+ // IIFE script — the same single <script src="renderer.js"> the HTML already loads.
7+ // Type-checking still happens via `tsc --noEmit`; this step only produces the bundle
8+ // and overwrites whatever tsc emitted for the renderer.
9+
10+ const esbuild = require ( 'esbuild' ) ;
11+
12+ esbuild
13+ . build ( {
14+ entryPoints : [ 'src/renderer/renderer.ts' ] ,
15+ bundle : true ,
16+ outfile : 'dist/renderer/renderer.js' ,
17+ platform : 'browser' ,
18+ target : 'es2022' ,
19+ format : 'iife' ,
20+ sourcemap : true ,
21+ legalComments : 'none' ,
22+ logLevel : 'info' ,
23+ } )
24+ . then ( ( ) => console . log ( 'renderer bundled → dist/renderer/renderer.js' ) )
25+ . catch ( ( err ) => {
26+ console . error ( 'renderer bundle failed:' , err ) ;
27+ process . exit ( 1 ) ;
28+ } ) ;
You can’t perform that action at this time.
0 commit comments