Skip to content

Commit ef3350e

Browse files
committed
fix: standalone build
1 parent e5e1815 commit ef3350e

6 files changed

Lines changed: 79 additions & 55 deletions

File tree

apps/next-blog/next.config.mjs

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,44 @@
1414
* @type {import('next').NextConfig}
1515
*/
1616
const nextConfig = {
17-
/* config options here */
18-
eslint: {
19-
ignoreDuringBuilds: true,
20-
},
21-
typescript: {
22-
ignoreBuildErrors: true,
23-
},
24-
// reactStrictMode: true,
25-
// i18n: {
26-
// locales: ["en"],
27-
// defaultLocale: "en",
28-
// },
29-
images: {
30-
domains: [
31-
'avatars.githubusercontent.com',
32-
'cote.azureedge.net',
33-
'res.cloudinary.com',
34-
'tailwindui.com',
35-
],
36-
},
37-
experimental: {
38-
outputFileTracingIgnores: ['**/@swc+core*'],
39-
},
40-
// rewrites: async () => [
41-
// {
42-
// source: '/rss.xml',
43-
// destination: '/rss',
44-
// },
45-
// {
46-
// source: '/rss.json',
47-
// destination: '/rss?type=json',
48-
// },
49-
// {
50-
// source: '/rss2.xml',
51-
// destination: '/rss?type=rss',
52-
// },
53-
// ],
54-
}
17+
/* config options here */
18+
eslint: {
19+
ignoreDuringBuilds: true,
20+
},
21+
typescript: {
22+
ignoreBuildErrors: true,
23+
},
24+
output: "standalone",
25+
// reactStrictMode: true,
26+
// i18n: {
27+
// locales: ["en"],
28+
// defaultLocale: "en",
29+
// },
30+
images: {
31+
domains: [
32+
"avatars.githubusercontent.com",
33+
"cote.azureedge.net",
34+
"res.cloudinary.com",
35+
"tailwindui.com",
36+
],
37+
},
38+
experimental: {
39+
outputFileTracingIgnores: ["**/@swc+core*"],
40+
},
41+
// rewrites: async () => [
42+
// {
43+
// source: '/rss.xml',
44+
// destination: '/rss',
45+
// },
46+
// {
47+
// source: '/rss.json',
48+
// destination: '/rss?type=json',
49+
// },
50+
// {
51+
// source: '/rss2.xml',
52+
// destination: '/rss?type=rss',
53+
// },
54+
// ],
55+
};
5556

56-
export default nextConfig
57+
export default nextConfig;

apps/next-blog/project.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
"build": {
2424
"executor": "nx:run-commands",
2525
"options": {
26-
"commands": ["next build apps/next-blog"],
26+
"commands": [
27+
"next build apps/next-blog",
28+
"mv apps/next-blog/.next/static apps/next-blog/.next/standalone/apps/next-blog/.next",
29+
"cp -r apps/next-blog/public apps/next-blog/.next/standalone/apps/next-blog/.next"
30+
],
2731
"outputPath": "apps/next-blog/.next"
2832
}
2933
},
@@ -51,6 +55,12 @@
5155
}
5256
}
5357
},
58+
"serve-standalone": {
59+
"executor": "nx:run-commands",
60+
"options": {
61+
"commands": ["node apps/next-blog/.next/standalone/apps/next-blog/server.js"]
62+
}
63+
},
5464
"export": {
5565
"executor": "@nx/next:export",
5666
"options": {

apps/og/next.config.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/**
44
* @type {import('next').NextConfig}
55
*/
6-
const config = {}
6+
const config = {
7+
output: "standalone",
8+
};
79

8-
export default config
10+
export default config;

apps/og/project.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@
55
"projectType": "application",
66
"targets": {
77
"build": {
8-
"executor": "@nx/next:build",
9-
"outputs": ["{options.outputPath}"],
10-
"defaultConfiguration": "production",
8+
"executor": "nx:run-commands",
119
"options": {
12-
"root": "apps/og",
13-
"outputPath": "dist/apps/og"
14-
},
15-
"configurations": {
16-
"development": {
17-
"outputPath": "apps/og"
18-
},
19-
"production": {}
10+
"commands": [
11+
"next build apps/og",
12+
"mv apps/og/.next/static apps/og/.next/standalone/apps/og/.next",
13+
"cp -r apps/og/public apps/og/.next/standalone/apps/og/.next"
14+
],
15+
"outputPath": "apps/og/.next"
2016
}
2117
},
2218
"serve": {
@@ -37,6 +33,12 @@
3733
}
3834
}
3935
},
36+
"serve-standalone": {
37+
"executor": "nx:run-commands",
38+
"options": {
39+
"commands": ["node apps/og/.next/standalone/apps/og/server.js"]
40+
}
41+
},
4042
"export": {
4143
"executor": "@nx/next:export",
4244
"options": {

apps/trialanderror.org/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const nextConfig = {
1717
typescript: {
1818
ignoreBuildErrors: true,
1919
},
20+
output: "standalone",
2021
eslint: {
2122
ignoreDuringBuilds: true,
2223
},

apps/trialanderror.org/project.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"projectType": "application",
66
"targets": {
77
"build": {
8-
"executor": "@nx/next:build",
98
"outputs": ["{options.outputPath}"],
109
"defaultConfiguration": "production",
1110
"options": {
@@ -17,7 +16,8 @@
1716
"outputPath": "apps/trialanderror.org"
1817
},
1918
"production": {}
20-
}
19+
},
20+
"command": "next build apps/trialanderror.org && mv apps/trialanderror.org/.next/static apps/trialanderror.org/.next/standalone/apps/trialanderror.org/.next && cp -r apps/trialanderror.org/public apps/trialanderror.org/.next/standalone/apps/trialanderror.org/.next"
2121
},
2222
"dev": {
2323
"executor": "nx:run-commands",
@@ -43,6 +43,14 @@
4343
}
4444
}
4545
},
46+
"serve-standalone": {
47+
"executor": "nx:run-commands",
48+
"options": {
49+
"commands": [
50+
"node apps/trialanderror.org/.next/standalone/apps/trialanderror.org/server.js"
51+
]
52+
}
53+
},
4654
"export": {
4755
"executor": "@nx/next:export",
4856
"options": {

0 commit comments

Comments
 (0)