-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(next): next.config.ts
#63051
feat(next): next.config.ts
#63051
Conversation
ref: vercel#57656 (comment) Co-authored-by: Donny/강동윤 <[email protected]>
Co-authored-by: rodrigo <[email protected]>
Co-authored-by: Sukka <[email protected]>
Amazing work, thank you! |
export const CONFIG_FILES = [ | ||
'next.config.js', | ||
'next.config.mjs', | ||
'next.config.ts', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If .mjs is supported, then why not .mts too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can handle native ESM in CJS project with next.config.ts
, no need for next.config.mts
, it should work.
Extensions
-
.ts
-
.cts
-
.mts
-
.cjs
-
.mjs
-
.js
(both ESM and CJS w/o extra change)
What?
This PR initiated support of
next.config.ts
.Follow ups:
Why?
This PR can resolve the two main needs:
type
instead of JSDoc.x-ref: #5318 #35969 #44632 #50121 #50126
How?
Goals
Used
require.extensions
hooks to transpile the imported files on the fly.To reduce I/O operation on disk, used custom
module.exports
to require directly from a transpiled code string.Expected
as default
Importing Files
node_modules
JSON
Extensions
.ts
.cts
.mts
.cjs
.mjs
.js
(both ESM and CJS w/o extra change)