-
Notifications
You must be signed in to change notification settings - Fork 28.3k
feat(next): next.config.ts
#57656
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
Closed
+859
−62
Closed
feat(next): next.config.ts
#57656
Changes from all commits
Commits
Show all changes
129 commits
Select commit
Hold shift + click to select a range
7c24a69
allow next.config.ts on load
devjiwonchoi 21b18e0
test: add test for next.config.ts
devjiwonchoi 407658d
add compile config
devjiwonchoi 3075e2a
chore: compile as mjs
devjiwonchoi bd61aec
test: add test case for production
devjiwonchoi 4ba992b
chore: add cache original config and skip compile if identical
devjiwonchoi 5fcfd50
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 834bdba
add next.config.ts to error message
devjiwonchoi 7c25030
remove caching snapshot of config
devjiwonchoi 7a0518c
fix: modify target version to esnext
devjiwonchoi 5a394a9
refac: convert to async job, error handle
devjiwonchoi cd2c8d8
test: modify test to look for rendered element
devjiwonchoi 22b1497
chore: use curLog for errors when failed compiling
devjiwonchoi 57ea7ff
chore: add read off tsconfig for module type
devjiwonchoi 7006fd3
chore: remove production test
devjiwonchoi bec6170
refac: output file ext always mjs
devjiwonchoi 8de3c81
test: add esm test
devjiwonchoi 5df0813
test: add cjs test
devjiwonchoi 540f6ae
fix: file ext mjs if not cjs
devjiwonchoi de02ca8
chore: add type for Log
devjiwonchoi ab6e908
refac: explicit type for error log
devjiwonchoi c9d2eb6
test: import type at esm
devjiwonchoi 4b2ed5a
chore: no module type check, just compile them as cjs
devjiwonchoi ff17aef
add more tests
devjiwonchoi 75758cc
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi f6aea6e
add failing tests
devjiwonchoi ab52aff
chore: naming as transpileConfig
devjiwonchoi 3c87454
test: remove unnecessary tsconfig
devjiwonchoi 1aeb69c
test: add necessary tsconfig.json
devjiwonchoi 6375316
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi d368dc4
Add strict mode and pure ESM import
devjiwonchoi b008c20
Refactor transpileConfig and loadConfig functions
devjiwonchoi 2b6c10b
Fix transpile-config and loadConfig functions
devjiwonchoi 5205dba
Update transpile-config and add new files for next-config-ts tests
devjiwonchoi 7dfc842
Add next.compiled.config.* to gitignore
devjiwonchoi 26c3e22
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi e4c7acf
refac: use temporary config
devjiwonchoi fcc0d55
Remove next.compiled.config from gitignore
devjiwonchoi 7e0855a
ensure import url
devjiwonchoi d8108e1
refac: transpile-config focus on returning code
devjiwonchoi ea5b249
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi db7836e
Delete tsconfig.json and .gitignore files
devjiwonchoi f972c6f
remove log type declaration
devjiwonchoi 02a47b2
Remove unused 'cwd' parameter in transpileConfig
devjiwonchoi 2b84702
modify test names
devjiwonchoi 1b9c204
test: add import from other ts
devjiwonchoi fa7a424
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 379aabc
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 1d3adfe
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 5e57291
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 39736a3
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi db25521
chore: save current work
devjiwonchoi 43a39d1
fix: taskfile and bundle5 terser-plugin path
devjiwonchoi 20f8c42
save for now - webpack does complete bundle but output is 0 byte
devjiwonchoi 8c63c93
refactor: re-compile if needed
devjiwonchoi 4c70e92
test: import-alias
devjiwonchoi 0aa3154
refactor: support path alias
devjiwonchoi c8d072b
chore: remove import-from-other-ts since path-alias can handle it
devjiwonchoi 03ce640
refactor: error handling transpile config
devjiwonchoi 0783399
refactor: remove resolve.extensions for webpack option
devjiwonchoi fb55de4
test: remove ALL current tests
devjiwonchoi cfb0851
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi bfa25b5
test: add import alias
devjiwonchoi 86d0201
test: export as default
devjiwonchoi 55dd8ad
test: add import from node modules
devjiwonchoi dfb8816
fix: add webpack.resolve.extensions
devjiwonchoi 9cc2ac9
refactor: next config options may be nullish
devjiwonchoi 23edb4d
test: config as async function
devjiwonchoi b6c7888
refactor: add alias for swc helpers
devjiwonchoi 0565dd7
test: config has no export default
devjiwonchoi a82e7ea
test: nest tests inside next-config-ts dir
devjiwonchoi 1d386b1
test: ensure config recompiled when needed
devjiwonchoi 555806a
refactor: pass nextconfig to bundleconfig as default empty obj
devjiwonchoi 5e7f21d
refactor: re-use inputFileSystem
devjiwonchoi 757108d
test: add dev server
devjiwonchoi 15995b5
refactor: remove unintended changes
devjiwonchoi 25293c9
test: ensure importing relative from root
devjiwonchoi 1f85d1b
fix: remove reusing inputFileSystem
devjiwonchoi 406b4ff
test: remove no default export since not throwing
devjiwonchoi 9e8f5b5
refactor: replace webpack bundle with require hook and swc transform
devjiwonchoi 3b49ca3
test: remove recompile
devjiwonchoi bf46de4
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 7f16812
Revert "fix: taskfile and bundle5 terser-plugin path"
devjiwonchoi 2e358df
refactor: modify variable names and add TODO
devjiwonchoi 419d1a9
test: add pkg type module esm project
devjiwonchoi 7c97ef5
test: add mts
devjiwonchoi 3b81c7d
test: ensure esm imports correctly
devjiwonchoi 932dd22
refactor: support ESM
devjiwonchoi 4caea8b
refactor: remove unintended fixes
devjiwonchoi 0d02318
refactor: return default
devjiwonchoi 259c08b
test: import .mts and .cts
devjiwonchoi 06c734c
refactor: support importing other ts extensions
devjiwonchoi 91c4f92
test: add esm mjs imports
devjiwonchoi e4d4870
refactor: handle import ESM
devjiwonchoi 1a3b83a
fix: do not modify require.extensions['.js']
devjiwonchoi 4840acf
test: add import esm from node_modules
devjiwonchoi a52e610
test: add nested imports
devjiwonchoi 230e44e
refactor: drop .cts, remove experimental log
devjiwonchoi 92065d4
refactor: register by detecting transpile-config not extensions
devjiwonchoi 598bdbc
chore: remove unrelated change
devjiwonchoi 16a2412
refactor: revert handling register via extensions
devjiwonchoi 519df26
chore: save progress before revert
devjiwonchoi d410013
refactor: transpile only or bundle if necessary
devjiwonchoi 00d2988
refactor: separate bundle method
devjiwonchoi 4f668ab
refactor: remove recompile, no unlinking config file
devjiwonchoi 54d0d3f
test: add cjs, esm, node-api
devjiwonchoi cd1922b
refactor: handle importing js extensions
devjiwonchoi abd46e8
fix: update taskfile's terser-webpack-plugin path
devjiwonchoi e430955
test: add next-config-mts
devjiwonchoi 0b698b2
refactor: webpack mode to production, fix on terser-plugin was needed
devjiwonchoi c3182c3
fix: allow .mts extension for swc-loader
devjiwonchoi d4f2abf
chore: remove tsconfig for next-config-mts test
devjiwonchoi 694c3a9
refactor: use nodejs api, add unlink since it breaks when using __dir…
devjiwonchoi b1ee1db
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 661b2fa
refactor: revert using .next dir, ensure __dirname to point cwd
devjiwonchoi 35c78f5
docs: add next.config.ts, but as an option not default
devjiwonchoi 80e6740
refactor: use next.config.ts for create next app-ts
devjiwonchoi 8800145
Merge branch 'canary' into next-config-ts-esm
devjiwonchoi 32fd66e
test: add dev
devjiwonchoi 34af164
refactor: use build cache on production server if exists
devjiwonchoi 9890443
refactor: remove unintended change
devjiwonchoi baaad07
refactor: try transpile-only first before any other operation
devjiwonchoi b7f50ab
test: add export default
devjiwonchoi c7765c8
refactor: join cwd with distDir to dedupe join operation
devjiwonchoi c1e796f
refactor: let loadConfig handle added default export of SWC transform
devjiwonchoi 8bd8863
test: add cjs syntax for direct migration from .js
devjiwonchoi 79b643d
docs: add we recommend next.config.ts if you are migrating to TS
devjiwonchoi 8e4c38e
fix: do not pass an absolute path to distDir
devjiwonchoi 1a61b97
Revert "fix: do not pass an absolute path to distDir"
devjiwonchoi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { NextConfig } from "next"; | ||
|
||
const nextConfig: NextConfig = {}; | ||
|
||
export default nextConfig; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { NextConfig } from "next"; | ||
|
||
const nextConfig: NextConfig = {}; | ||
|
||
export default nextConfig; |
5 changes: 5 additions & 0 deletions
5
packages/create-next-app/templates/default-tw/ts/next.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { NextConfig } from "next"; | ||
|
||
const nextConfig: NextConfig = { reactStrictMode: true }; | ||
|
||
export default nextConfig; |
6 changes: 0 additions & 6 deletions
6
packages/create-next-app/templates/default/ts/next.config.mjs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { NextConfig } from "next"; | ||
|
||
const nextConfig: NextConfig = { reactStrictMode: true }; | ||
|
||
export default nextConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,11 @@ const regeneratorRuntimePath = require.resolve( | |
) | ||
|
||
function isTypeScriptFile(filename: string) { | ||
return filename.endsWith('.ts') || filename.endsWith('.tsx') | ||
return ( | ||
filename.endsWith('.ts') || | ||
filename.endsWith('.mts') || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To allow |
||
filename.endsWith('.tsx') | ||
) | ||
} | ||
|
||
function isCommonJSFile(filename: string) { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Temporarily set version as
v14.2.0