From 320986a2b897bc512c21f7148f4a4c8ce749dcae Mon Sep 17 00:00:00 2001 From: David Babel Date: Sat, 8 Jan 2022 02:47:22 +0100 Subject: [PATCH] Update next.config.js (#33091) ## Feature We are in a Typescript context, but the `next.config.js` cannot be parsed as is, since it fails on `File is a CommonJS module; it may be converted to an ES module.ts(80001)` so it does not parse the rest of the file : ![image](https://user-images.githubusercontent.com/5599375/148612812-de50b5d9-609e-4273-9892-5b3a4ad0b282.png) Here we should have an error because the type is not the expected one. With a little trick, it's possible to enable the check by : - adding `// @ts-check` at first line - moving the export at the end of the file And then it works like a charm : ![image](https://user-images.githubusercontent.com/5599375/148612666-ae5350d8-f16e-45e0-84e4-b31faf07fcca.png) Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> --- packages/create-next-app/templates/typescript/next.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/create-next-app/templates/typescript/next.config.js b/packages/create-next-app/templates/typescript/next.config.js index 8b61df4e50f8a..a843cbee09afa 100644 --- a/packages/create-next-app/templates/typescript/next.config.js +++ b/packages/create-next-app/templates/typescript/next.config.js @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -module.exports = { +const nextConfig = { reactStrictMode: true, } + +module.exports = nextConfig