From 3585559fa0e767581857bf71383e7b9bb4c97783 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 11 Nov 2024 11:42:09 +0800 Subject: [PATCH] fix build --- package.json | 7 +++---- src/app.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3ec0cbf..75a0f0b 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,17 @@ "tsc": "tsc && tsc -p frontend/tsconfig.json", "test": "exit 0", "build": "esbuild src/index.ts --bundle --platform=node --outfile=dist/index.js --format=cjs --sourcemap=inline", - "build:frontend": "cd frontend && yarn build", + "build:frontend": "(cd frontend && yarn build) && rm -rf dist/frontend && mkdir -p dist && mv frontend/dist dist/frontend", "watch": "yarn build --watch", - "prepack": "npm run build", + "prepack": "yarn build", "dev": "yarn build && concurrently -k \"cd frontend && yarn dev\" \"yarn watch\" \"node --enable-source-maps --watch . --dev-mode\"" }, "files": [ - "/frontend/dist/**", "/dist/**" ], "pkg": { "assets": [ - "frontend/dist/**" + "dist/**" ] }, "dependencies": { diff --git a/src/app.ts b/src/app.ts index 49eeeff..995ea90 100644 --- a/src/app.ts +++ b/src/app.ts @@ -285,8 +285,8 @@ export default ({ sharedPath: sharedPathIn, port, maxUploadSize, zipCompressionL // Serving the frontend depending on dev/production if (devMode) app.use('/', createProxyMiddleware({ target: 'http://localhost:3000', ws: true })); - else app.use('/', express.static(join(__dirname, '../frontend/dist'))); + else app.use('/', express.static(join(__dirname, 'frontend'))); // Default to index because SPA - app.use('*', (_req, res) => res.sendFile(join(__dirname, '../frontend/dist/index.html'))); + app.use('*', (_req, res) => res.sendFile(join(__dirname, 'frontend/index.html'))); };