diff --git a/builder-debug.config.ts b/builder-debug.config.ts index 17f68322..777d31c8 100644 --- a/builder-debug.config.ts +++ b/builder-debug.config.ts @@ -8,7 +8,7 @@ const debugConfig: Configuration = { { from: './assets/uv/uvx', to: 'uv/uvx' }, { from: './assets/UI', to: 'UI' }, ], - beforeBuild: './scripts/preMake.cjs', + beforeBuild: './scripts/preMake.js', win: { icon: './assets/UI/Comfy_Logo.ico', target: 'zip', diff --git a/package.json b/package.json index bc3569dc..bb7a4e1b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "version": "0.3.34", "homepage": "https://comfy.org", "description": "The best modular GUI to run AI diffusion models.", - "main": ".vite/build/main.js", + "main": ".vite/build/main.cjs", "packageManager": "yarn@4.5.0", "type": "module", "config": { diff --git a/scripts/preMake.cjs b/scripts/preMake.js similarity index 84% rename from scripts/preMake.cjs rename to scripts/preMake.js index 3a3fd84f..f9162ac2 100644 --- a/scripts/preMake.cjs +++ b/scripts/preMake.js @@ -1,10 +1,10 @@ -const { exec, execSync, spawnSync, spawn } = require("child_process"); -const path = require("path"); -const os = require('os'); -const process = require("process"); -const fs = require('fs-extra'); +import { exec, execSync, spawnSync, spawn } from "child_process" +import path from "path" +import * as os from 'os' +import process from "process" +import fs from 'fs-extra' -module.exports = async ({ appOutDir, packager, outDir }) => { +export default async ({ appOutDir, packager, outDir }) => { const firstInstallOnToDesktopServers = process.env.TODESKTOP_CI && process.env.TODESKTOP_INITIAL_INSTALL_PHASE; diff --git a/src/main-process/appWindow.ts b/src/main-process/appWindow.ts index d051224c..dc5b75bd 100644 --- a/src/main-process/appWindow.ts +++ b/src/main-process/appWindow.ts @@ -45,7 +45,7 @@ export class AppWindow { x: storedX, y: storedY, webPreferences: { - preload: path.join(import.meta.dirname, '../build/preload.cjs'), + preload: path.join(__dirname, '../build/preload.mjs'), nodeIntegration: true, contextIsolation: true, webviewTag: true, diff --git a/tsconfig.json b/tsconfig.json index 5f13ddcc..0bc2e1ec 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "jsx": "react", "target": "ESNext", - "module": "ES2022", + "module": "ESNext", "allowJs": true, "strict": true, "skipLibCheck": true, diff --git a/vite.main.config.ts b/vite.main.config.ts index 3c1b8c33..079b15b3 100644 --- a/vite.main.config.ts +++ b/vite.main.config.ts @@ -11,8 +11,8 @@ export default defineConfig((env) => { outDir: '.vite/build', lib: { entry: './src/main.ts', - fileName: () => '[name].js', - formats: ['es'], + fileName: (_format, name) => `${name}.cjs`, + formats: ['cjs'], }, rollupOptions: { external,