chore(server/esbuild): switch to cjs to embed deps

This commit is contained in:
Elian Doran 2025-05-23 11:56:45 +03:00
parent 9ff2271423
commit 1abf1d3f60
No known key found for this signature in database
3 changed files with 8 additions and 17 deletions

View File

@ -114,21 +114,12 @@
"targets": {
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"dependsOn": [
"build-without-client"
],
"options": {
"buildTarget": "server:build",
"buildTarget": "server:build-without-client:development",
"runBuildTargetDependencies": false
},
"configurations": {
"development": {
"buildTarget": "server:build-without-client"
},
"production": {
"buildTarget": "server:build:production"
}
}
},
"package": {
@ -141,7 +132,7 @@
"dependsOn": [
"build"
],
"command": "node apps/server/dist/main.js"
"command": "node apps/server/dist/main.cjs"
},
"docker-build": {
"dependsOn": [
@ -190,10 +181,12 @@
"platform": "node",
"external": [
"electron",
"@electron/remote"
"@electron/remote",
"better-sqlite3",
"jsdom"
],
"format": [
"esm"
"cjs"
],
"declarationRootDir": "apps/server/src"
},
@ -264,6 +257,5 @@
},
"types": "./dist/main.d.ts",
"module": "./dist/main.js",
"type": "module",
"main": "./dist/main.js"
}

View File

@ -1,6 +1,5 @@
import { assetUrlFragment } from "../services/asset_path.js";
import path from "path";
import { fileURLToPath } from "url";
import express from "express";
import { getResourceDir, isDev } from "../services/utils.js";
import type serveStatic from "serve-static";
@ -18,7 +17,7 @@ const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOp
};
async function register(app: express.Application) {
const srcRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
const srcRoot = path.join(__dirname, "..");
const resourceDir = getResourceDir();
if (isDev) {

View File

@ -16,7 +16,7 @@ let dayjsLocale: string;
export async function initializeTranslations() {
const resourceDir = getResourceDir();
const Backend = (await import("i18next-fs-backend")).default;
const Backend = (await import("i18next-fs-backend/cjs")).default;
const locale = getCurrentLanguage();
// Initialize translations