mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
Registering IPC handlers costs 0.4 ms; evaluating the modules behind them (axios, drizzle-orm, better-sqlite3, electron-updater, fix-path) before the window could load was the real cost. main.ts now keeps only the pre-paint wiring and loads the rest as the deferred-events.js chunk inside the main window's did-start-loading listener, where the import and its registrations complete before any renderer invoke can arrive. Interleaved A/B on the performance build: app.whenReady 323 -> 265 ms, did-finish-load 499 -> 447 ms; J1 journey spawnToDidFinishLoad ~405 -> ~365 ms with identical counters. Packaging ships the chunk explicitly, verify:package-layout requires it, and the benchmark build identity hashes it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
22 lines
786 B
JavaScript
22 lines
786 B
JavaScript
/**
|
|
* nx-electron build hook (project.json `webpackConfig`).
|
|
*
|
|
* The backend compiles with TypeScript's NodeNext resolution, which spells a
|
|
* relative dynamic import with a `.js` extension (main.ts loads
|
|
* `./app/startup/deferred-events.js`). webpack must map that back onto the
|
|
* `.ts` source, which is what `resolve.extensionAlias` does.
|
|
*/
|
|
module.exports = (config) => {
|
|
// Async chunks keep their webpackChunkName instead of a numeric id, so
|
|
// packaging and the layout check can list them by name.
|
|
config.output = { ...config.output, chunkFilename: '[name].js' };
|
|
config.resolve = {
|
|
...config.resolve,
|
|
extensionAlias: {
|
|
...config.resolve?.extensionAlias,
|
|
'.js': ['.ts', '.js'],
|
|
},
|
|
};
|
|
return config;
|
|
};
|