fix: backend won't start

This commit is contained in:
2026-07-08 11:31:38 +02:00
parent 84fa2e0ab0
commit 87bed4e1c7
7 changed files with 2240 additions and 344 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
},
"modules": false
}
],
"@babel/preset-typescript"
]
}
+9 -3
View File
@@ -5,8 +5,9 @@
"main": "server.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.ts",
"dev": "node --watch server.ts"
"start": "node dist/server.js",
"dev": "tsx --watch server.ts",
"build": "babel server.ts routes services --extensions .ts --out-dir dist --copy-files"
},
"keywords": [],
"author": "",
@@ -22,7 +23,12 @@
"mysql2": "^3.16.0"
},
"devDependencies": {
"@babel/cli": "^8.0.1",
"@babel/core": "^8.0.1",
"@babel/preset-env": "^8.0.2",
"@babel/preset-typescript": "^8.0.1",
"@types/express": "^5.0.6",
"@types/node": "^26.1.0"
"@types/node": "^26.1.0",
"tsx": "^4.23.0"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
import express from "express";
import dotenv from "dotenv";
import {authenticate, generateToken} from "../../services/tokenService.js";
import {authenticate, generateToken} from "../../services/tokenService.ts";
import {changePassword, findUser, getSettings, loginUser, updateSettings,} from "./database/users.database.ts";
import {GENERAL_ERROR_CODE, USER_ERROR_CODE} from "@stockhome/shared";
+8 -11
View File
@@ -1,7 +1,7 @@
import {defineConfig} from 'vite'
import path from 'path'
import {dirname} from "node:path";
import {fileURLToPath} from "node:url";
import {dirname} from "node:path"
import {fileURLToPath} from "node:url"
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -12,21 +12,18 @@ export default defineConfig({
outDir: '../dist',
emptyOutDir: true,
sourcemap: true,
minify: 'esbuild', // Use esbuild for minification (default)
minify: 'esbuild',
assetsDir: 'assets',
rollupOptions: {
input: path.resolve(__dirname, 'src/index.html'),
output: {
assetFileNames: 'assets/[name]-[hash][extname]' // Hashing for cache busting
}
}
assetFileNames: 'assets/[name]-[hash][extname]',
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'), // Optional alias for cleaner imports
}
'@': path.resolve(__dirname, 'src'),
},
},
define: {
'process.env.NODE_ENV': '"production"' // Inject environment variables
}
})