mirror of
https://github.com/felixrieseberg/windows95.git
synced 2026-05-09 00:24:09 +00:00
Swap the unmaintained parcel-bundler@1.x for Vite's build API, called
from the same generateAssets hook. Output layout is unchanged
(dist/src/main/main.js + dist/static/index.html + dist/renderer.{js,css})
so no runtime path changes — __dirname-based asset lookup, loadFile, and
packagerConfig.ignore all keep working.
Renderer is built in lib/CJS mode with Node builtins + electron
externalized; a one-line banner aliases exports=module.exports since the
Electron <script> context provides module/require but not a bare exports
global. CSS (98.css + root.css) is now imported from app.tsx so Vite
emits a single renderer.css with fonts inlined.
Drops parcel-bundler and rimraf (vite-build clears dist/ itself).
~800ms full build.
46 lines
970 B
TypeScript
46 lines
970 B
TypeScript
import "../css/vendor/98.css";
|
|
import "../css/root.css";
|
|
|
|
export interface Win95Window extends Window {
|
|
emulator: any;
|
|
win95: {
|
|
app: App;
|
|
};
|
|
}
|
|
|
|
declare let window: Win95Window;
|
|
|
|
/**
|
|
* The top-level class controlling the whole app. This is *not* a React component,
|
|
* but it does eventually render all components.
|
|
*
|
|
* @class App
|
|
*/
|
|
export class App {
|
|
/**
|
|
* Initial setup call, loading Monaco and kicking off the React
|
|
* render process.
|
|
*/
|
|
public async setup(): Promise<void> {
|
|
const React = await import("react");
|
|
const { createRoot } = await import("react-dom/client");
|
|
const { Emulator } = await import("./emulator");
|
|
|
|
const className = `${process.platform}`;
|
|
const app = (
|
|
<div className={className}>
|
|
<Emulator />
|
|
</div>
|
|
);
|
|
|
|
const root = createRoot(document.getElementById("app")!);
|
|
root.render(app);
|
|
}
|
|
}
|
|
|
|
window.win95 = window.win95 || {
|
|
app: new App(),
|
|
};
|
|
|
|
window.win95.app.setup();
|