Fix: Only serve static files from dist in production
- Added NODE_ENV check before serving static files from ./dist - Prevents 'serveStatic: root path ./dist is not found' error in development - Keeps Docker/production configuration intact - Development mode now works with pnpm dev without build step
This commit is contained in:
@@ -55,9 +55,11 @@ Canonical: https://${process.env.DOMAIN || 'localhost:5173'}/.well-known/securit
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Serve static files
|
// Serve static files (only in production)
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
app.use('/static/*', serveStatic({ root: './dist' }));
|
app.use('/static/*', serveStatic({ root: './dist' }));
|
||||||
app.use('/assets/*', serveStatic({ root: './dist' }));
|
app.use('/assets/*', serveStatic({ root: './dist' }));
|
||||||
|
}
|
||||||
app.use('/favicon.png', serveStatic({ path: './public/favicon.png' }));
|
app.use('/favicon.png', serveStatic({ path: './public/favicon.png' }));
|
||||||
|
|
||||||
app.route("/rpc", rpcApp);
|
app.route("/rpc", rpcApp);
|
||||||
|
Reference in New Issue
Block a user