diff --git a/cli/src/helpers/createProject.ts b/cli/src/helpers/createProject.ts index 92aa6ed49e..81b385485f 100644 --- a/cli/src/helpers/createProject.ts +++ b/cli/src/helpers/createProject.ts @@ -64,8 +64,8 @@ export const createProject = async ({ if (appRouter) { // Replace next.config fs.copyFileSync( - path.join(PKG_ROOT, "template/extras/config/next-config-appdir.ts"), - path.join(projectDir, "next.config.ts") + path.join(PKG_ROOT, "template/extras/config/next-config-appdir.js"), + path.join(projectDir, "next.config.js") ); selectLayoutFile({ projectDir, packages }); diff --git a/cli/src/installers/envVars.ts b/cli/src/installers/envVars.ts index 281ea7e331..a7377ccf6e 100644 --- a/cli/src/installers/envVars.ts +++ b/cli/src/installers/envVars.ts @@ -44,7 +44,7 @@ export const envVariablesInstaller: Installer = ({ "template/extras/src/env", envFile ); - const envSchemaDest = path.join(projectDir, "src/env.ts"); + const envSchemaDest = path.join(projectDir, "src/env.js"); fs.copyFileSync(envSchemaSrc, envSchemaDest); } @@ -63,7 +63,7 @@ const getEnvContent = ( scopedAppName: string ) => { let content = ` -# When adding additional environment variables, the schema in "/src/env.ts" +# When adding additional environment variables, the schema in "/src/env.js" # should be updated accordingly. ` .trim() diff --git a/cli/template/base/next.config.ts b/cli/template/base/next.config.js similarity index 55% rename from cli/template/base/next.config.ts rename to cli/template/base/next.config.js index a3c840a8ca..98b6f90a51 100644 --- a/cli/template/base/next.config.ts +++ b/cli/template/base/next.config.js @@ -1,18 +1,23 @@ -import { type NextConfig } from "next"; - /** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ -import "./src/env"; +await import("./src/env.js"); +/** @type {import("next").NextConfig} */ const config = { reactStrictMode: true, + + /** + * If you are using `appDir` then you must comment the below `i18n` config out. + * + * @see https://github.com/vercel/next.js/issues/41980 + */ i18n: { locales: ["en"], defaultLocale: "en", }, transpilePackages: ["geist"], -} satisfies NextConfig; +}; export default config; diff --git a/cli/template/base/src/env.ts b/cli/template/base/src/env.js similarity index 100% rename from cli/template/base/src/env.ts rename to cli/template/base/src/env.js diff --git a/cli/template/extras/config/next-config-appdir.ts b/cli/template/extras/config/next-config-appdir.js similarity index 60% rename from cli/template/extras/config/next-config-appdir.ts rename to cli/template/extras/config/next-config-appdir.js index 812e25a83f..9bfe4a0e2a 100644 --- a/cli/template/extras/config/next-config-appdir.ts +++ b/cli/template/extras/config/next-config-appdir.js @@ -1,11 +1,10 @@ -import { type NextConfig } from "next"; - /** * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful * for Docker builds. */ -import "./src/env"; +await import("./src/env.js"); -const config = {} satisfies NextConfig; +/** @type {import("next").NextConfig} */ +const config = {}; export default config;