Skip to content
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

Stop overriding the user's TS config with defaults during next build #45670

Merged
merged 13 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/src/lib/typescript/runTypeCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export async function runTypeCheck(
const requiredConfig = getRequiredConfiguration(ts)

const options = {
...effectiveConfiguration.options,
...requiredConfig,
...effectiveConfiguration.options,
declarationMap: false,
emitDeclarationOnly: false,
noEmit: true,
Expand Down
6 changes: 3 additions & 3 deletions test/integration/tsconfig-verifier/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
/* eslint-disable @typescript-eslint/no-unused-vars */
const blah: boolean = false
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const blah2 = import('../value').then((r) => r.default)
// @ts-expect-error ignore the import issue here caused by https://github.com/microsoft/TypeScript/issues/49083
const blah2 = import('../value.ts').then((r) => r.default)

export default () => <h3>Hello TypeScript</h3>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import helloWorldString from 'pkg/sub-export'

export default function Page() {
return <p>{helloWorldString}</p>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "pkg",
"version": "1.0.0",
"type": "module",
"exports": {
"./sub-export": "./src/some-file.js"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: 'Hello, world'
export default _default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 'Hello, world'
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { createNextDescribe, FileRef } from 'e2e-utils'
import { join } from 'path'

// regression test suite for https://github.com/vercel/next.js/issues/38854
createNextDescribe(
'Does not override tsconfig moduleResolution field during build',
{
packageJson: { type: 'module' },
files: {
'tsconfig.json': new FileRef(join(__dirname, 'tsconfig.json')),
pages: new FileRef(join(__dirname, 'pages')),
pkg: new FileRef(join(__dirname, 'pkg')),
},
dependencies: {
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
pkg: './pkg',
},
},
({ next }) => {
it('boots and renders without throwing an error', async () => {
await next.render$('/')
})
}
)
20 changes: 20 additions & 0 deletions test/production/supports-module-resolution-nodenext/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"esModuleInterop": true,
"module": "esnext",
"jsx": "preserve",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"isolatedModules": true
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "components", "pages"]
}