Spaces:
Sleeping
Sleeping
Fix build error: Use Next.js static export (out folder) instead of dist
Browse files- Dockerfile +2 -4
- client/next.config.mjs +4 -0
- server/src/index.js +1 -1
Dockerfile
CHANGED
|
@@ -28,10 +28,8 @@ COPY server/package*.json ./
|
|
| 28 |
RUN npm install
|
| 29 |
COPY server/ .
|
| 30 |
|
| 31 |
-
# Copy Client build (the server expects it at ../client/
|
| 32 |
-
|
| 33 |
-
# Let's adjust server's clientPath logic slightly or copy it to /client/dist
|
| 34 |
-
COPY --from=client-builder /client/dist /client/dist
|
| 35 |
|
| 36 |
# Environment
|
| 37 |
ENV PORT=7860
|
|
|
|
| 28 |
RUN npm install
|
| 29 |
COPY server/ .
|
| 30 |
|
| 31 |
+
# Copy Client build (the server expects it at ../client/out relative to server/src/index.js)
|
| 32 |
+
COPY --from=client-builder /client/out /client/out
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Environment
|
| 35 |
ENV PORT=7860
|
client/next.config.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
/** @type {import('next').NextConfig} */
|
| 2 |
const nextConfig = {
|
|
|
|
| 3 |
reactStrictMode: true,
|
|
|
|
|
|
|
|
|
|
| 4 |
eslint: {
|
| 5 |
// Warning: This allows production builds to successfully complete even if
|
| 6 |
// your project has ESLint errors.
|
|
|
|
| 1 |
/** @type {import('next').NextConfig} */
|
| 2 |
const nextConfig = {
|
| 3 |
+
output: 'export',
|
| 4 |
reactStrictMode: true,
|
| 5 |
+
images: {
|
| 6 |
+
unoptimized: true,
|
| 7 |
+
},
|
| 8 |
eslint: {
|
| 9 |
// Warning: This allows production builds to successfully complete even if
|
| 10 |
// your project has ESLint errors.
|
server/src/index.js
CHANGED
|
@@ -46,7 +46,7 @@ app.use(rateLimiter);
|
|
| 46 |
app.use('/api', routes);
|
| 47 |
|
| 48 |
// Serve Static Files for Deployment
|
| 49 |
-
const clientPath = path.join(__dirname, '../../client/
|
| 50 |
app.use(express.static(clientPath));
|
| 51 |
|
| 52 |
// Handle React SPA routing
|
|
|
|
| 46 |
app.use('/api', routes);
|
| 47 |
|
| 48 |
// Serve Static Files for Deployment
|
| 49 |
+
const clientPath = path.join(__dirname, '../../client/out');
|
| 50 |
app.use(express.static(clientPath));
|
| 51 |
|
| 52 |
// Handle React SPA routing
|