未验证 提交 17af901d 编写于 作者: T Tobias Koppers 提交者: GitHub

Merge branch 'canary' into webpack/upgrade

...@@ -24,6 +24,6 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut ...@@ -24,6 +24,6 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
### TypeScript Setup (optional) ### TypeScript Setup (optional)
If you haven't already added [TypeScript](https://www.typescriptlang.org/) to your project, follow the [steps in the Next.js documentation](https://nextjs.org/docs/basic-features/TypeScript). If you are new to TypeScript, go through the Next.js [learning lesson on TypeScript](https://nextjs.org/learn/excel/TypeScript). If you haven't already added [TypeScript](https://www.typescriptlang.org/) to your project, follow the [steps in the Next.js documentation](https://nextjs.org/docs/basic-features/typescript). If you are new to TypeScript, go through the Next.js [learning lesson on TypeScript](https://nextjs.org/learn/excel/TypeScript).
Once TypeScript is added, follow the instructions given on the Redux Toolkit [documentation](https://redux-toolkit.js.org/tutorials/TypeScript) to set up and use Redux Toolkit and React-Redux with TypeScript Once TypeScript is added, follow the instructions given on the Redux Toolkit [documentation](https://redux-toolkit.js.org/tutorials/TypeScript) to set up and use Redux Toolkit and React-Redux with TypeScript
...@@ -151,8 +151,8 @@ export default async function build( ...@@ -151,8 +151,8 @@ export default async function build(
} }
} }
const buildSpinner = createSpinner({ const typeCheckingSpinner = createSpinner({
prefixText: `${Log.prefixes.info} Creating an optimized production build`, prefixText: `${Log.prefixes.info} Checking validity of types`,
}) })
const telemetry = new Telemetry({ distDir }) const telemetry = new Telemetry({ distDir })
...@@ -182,6 +182,14 @@ export default async function build( ...@@ -182,6 +182,14 @@ export default async function build(
verifyTypeScriptSetup(dir, pagesDir, !ignoreTypeScriptErrors) verifyTypeScriptSetup(dir, pagesDir, !ignoreTypeScriptErrors)
) )
if (typeCheckingSpinner) {
typeCheckingSpinner.stopAndPersist()
}
const buildSpinner = createSpinner({
prefixText: `${Log.prefixes.info} Creating an optimized production build`,
})
const isLikeServerless = isTargetLikeServerless(target) const isLikeServerless = isTargetLikeServerless(target)
const pagePaths: string[] = await nextBuildSpan const pagePaths: string[] = await nextBuildSpan
......
...@@ -75,7 +75,9 @@ export function getOriginalStackFrame( ...@@ -75,7 +75,9 @@ export function getOriginalStackFrame(
external: false, external: false,
expanded: !Boolean( expanded: !Boolean(
/* collapsed */ /* collapsed */
body.originalStackFrame?.file?.includes('node_modules') ?? true (source.file?.includes('node_modules') ||
body.originalStackFrame?.file?.includes('node_modules')) ??
true
), ),
sourceStackFrame: source, sourceStackFrame: source,
originalStackFrame: body.originalStackFrame, originalStackFrame: body.originalStackFrame,
......
...@@ -114,12 +114,14 @@ export async function createOriginalStackFrame({ ...@@ -114,12 +114,14 @@ export async function createOriginalStackFrame({
line, line,
column, column,
source, source,
modulePath,
rootDirectory, rootDirectory,
frame, frame,
}: { }: {
line: number line: number
column: number | null column: number | null
source: any source: any
modulePath?: string
rootDirectory: string rootDirectory: string
frame: any frame: any
}): Promise<OriginalStackFrameResponse | null> { }): Promise<OriginalStackFrameResponse | null> {
...@@ -140,7 +142,7 @@ export async function createOriginalStackFrame({ ...@@ -140,7 +142,7 @@ export async function createOriginalStackFrame({
const filePath = path.resolve( const filePath = path.resolve(
rootDirectory, rootDirectory,
getSourcePath(sourcePosition.source) modulePath || getSourcePath(sourcePosition.source)
) )
const originalFrame: StackFrame = { const originalFrame: StackFrame = {
...@@ -285,6 +287,7 @@ function getOverlayMiddleware(options: OverlayMiddlewareOptions) { ...@@ -285,6 +287,7 @@ function getOverlayMiddleware(options: OverlayMiddlewareOptions) {
column: frameColumn, column: frameColumn,
source, source,
frame, frame,
modulePath: moduleId,
rootDirectory: options.rootDirectory, rootDirectory: options.rootDirectory,
}) })
......
...@@ -630,6 +630,31 @@ test('boundaries', async () => { ...@@ -630,6 +630,31 @@ test('boundaries', async () => {
await cleanup() await cleanup()
}) })
// https://github.com/vercel/next.js/pull/23203
test('internal package errors', async () => {
const [session, cleanup] = await sandbox()
// Make a react build-time error.
await session.patch(
'index.js',
`
import * as React from 'react';
export default function FunctionNamed() {
return <div>{{}}</div>
}`
)
expect(await session.hasRedbox(true)).toBe(true)
// We internally only check the script path, not including the line number
// and error message because the error comes from an external library.
// This test ensures that the errored script path is correctly resolved.
expect(await session.getRedboxSource()).toContain(
`../../../../packages/next/dist/pages/_document.js`
)
await cleanup()
})
test('unterminated JSX', async () => { test('unterminated JSX', async () => {
const [session, cleanup] = await sandbox() const [session, cleanup] = await sandbox()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册