Skip to content

Commit 360901f

Browse files
authored
[cna] Preserve existing config option when enabling React Compiler (#84663)
1 parent a004996 commit 360901f

File tree

10 files changed

+23
-16
lines changed

10 files changed

+23
-16
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
/* config options here */
4+
};
35

46
export default nextConfig;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
/* config options here */
4+
};
35

46
export default nextConfig;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
/* config options here */
4+
};
35

46
export default nextConfig;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
/* config options here */
4+
};
35

46
export default nextConfig;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
/* config options here */
4+
};
35

46
export default nextConfig;

packages/create-next-app/templates/default-empty/js/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
/* config options here */
34
reactStrictMode: true,
45
};
56

packages/create-next-app/templates/default-tw-empty/js/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
/* config options here */
34
reactStrictMode: true,
45
};
56

packages/create-next-app/templates/default-tw/js/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
/* config options here */
34
reactStrictMode: true,
45
};
56

packages/create-next-app/templates/default/js/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3+
/* config options here */
34
reactStrictMode: true,
45
};
56

packages/create-next-app/templates/index.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,10 @@ export const installTemplate = async ({
103103
);
104104
let configContent = await fs.readFile(nextConfigFile, "utf8");
105105

106-
if (mode === "ts") {
107-
configContent = configContent.replace(
108-
"const nextConfig: NextConfig = {\n /* config options here */\n};",
109-
`const nextConfig: NextConfig = {\n reactCompiler: true,\n};`,
110-
);
111-
} else {
112-
configContent = configContent.replace(
113-
"const nextConfig = {};",
114-
`const nextConfig = {\n reactCompiler: true,\n};`,
115-
);
116-
}
106+
configContent = configContent.replace(
107+
"/* config options here */\n",
108+
"/* config options here */\n reactCompiler: true,\n",
109+
);
117110

118111
await fs.writeFile(nextConfigFile, configContent);
119112
}

0 commit comments

Comments
 (0)