next.js
next.js copied to clipboard
Sourcemap errors in terminal by default
Requires experimental.serverSourceMaps.
When an error is logged (e.g. console.error(error)), we'll now display the stack sourcemapped and include a sourceframe. We already do this with a couple of errors but now we'll do it consistently.
For
export default function Page() {
const error = new Error("Boom!");
console.error(error);
return null;
}
Node.js terminal:
Error: Boom
at Page (webpack-internal:///(rsc)/./app/page.tsx:6:19)
at react-stack-bottom-frame (webpack-internal:///(react-server)/./dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js:3558:20)
[...]
Boom
at Page (webpack:///app/page.tsx?7603:2:16)
Node.js --inspect (no changes):
Browser (no changes):
Follow-up:
--enable-source-mapsby default whenexperimental.serverSourceMaps: true(does this cause a noticeably slowernext-build?)- replace
logErrorWithOriginalStackwithconsole.errorinsetup-dev-bundler - ship
experimental.serverSourceMaps(probably need to consider security. Might be easier to split into build-only server sourcemaps which is the critical part of this work or just create sourcemaps during build that we ensure are not part of the deploy) - get rid of
webpack://prefixing via https://webpack.js.org/configuration/output/#outputdevtoolmodulefilenametemplate to that locations are clickable
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @eps1lon and the rest of your teammates on
Graphite
Failing test suites
Commit: 1513e5b6a92b7846b788dd45cd0c02a87edb8329
pnpm test test/integration/edge-runtime-module-errors/test/module-imports.test.js
- Edge runtime code with imports > Edge API statically importing node.js module > throws unsupported module error in dev at runtime and highlights the faulty line
Expand output
● Edge runtime code with imports › Edge API statically importing node.js module › throws unsupported module error in dev at runtime and highlights the faulty line
expect(received).toBe(expected) // Object.is equality
Expected: 500
Received: 404
88 | await retry(async () => {
89 | const res = await fetchViaHTTP(context.appPort, url)
> 90 | expect(res.status).toBe(500)
| ^
91 | const text = await res.text()
92 | expectUnsupportedModuleDevError(moduleName, importStatement, text)
93 | })
at toBe (integration/edge-runtime-module-errors/test/module-imports.test.js:90:28)
at retry (lib/next-test-utils.ts:806:14)
at Object.<anonymous> (integration/edge-runtime-module-errors/test/module-imports.test.js:88:7)
Read more about building and testing Next.js in contributing.md.
Stats from current PR
Default Build (Increase detected ⚠️)
General Overall increase ⚠️
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| buildDuration | 18.6s | 23s | ⚠️ +4.4s |
| buildDurationCached | 15.3s | 13.9s | N/A |
| nodeModulesSize | 374 MB | 402 MB | ⚠️ +28.6 MB |
| nextStartRea..uration (ms) | 432ms | 471ms | N/A |
Client Bundles (main, webpack)
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| 4172-HASH.js gzip | 45.2 kB | 45 kB | N/A |
| 4265-HASH.js gzip | 5.27 kB | 5.26 kB | N/A |
| 7ac8fc69-HASH.js gzip | 52.6 kB | 52.6 kB | N/A |
| 9045.HASH.js gzip | 169 B | 169 B | ✓ |
| framework-HASH.js gzip | 57.4 kB | 57.4 kB | N/A |
| main-app-HASH.js gzip | 233 B | 233 B | ✓ |
| main-HASH.js gzip | 33 kB | 32.9 kB | N/A |
| webpack-HASH.js gzip | 1.71 kB | 1.71 kB | ✓ |
| Overall change | 2.11 kB | 2.11 kB | ✓ |
Legacy Client Bundles (polyfills)
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| polyfills-HASH.js gzip | 39.4 kB | 39.4 kB | ✓ |
| Overall change | 39.4 kB | 39.4 kB | ✓ |
Client Pages
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| _app-HASH.js gzip | 192 B | 192 B | ✓ |
| _error-HASH.js gzip | 192 B | 191 B | N/A |
| amp-HASH.js gzip | 506 B | 512 B | N/A |
| css-HASH.js gzip | 343 B | 342 B | N/A |
| dynamic-HASH.js gzip | 1.84 kB | 1.85 kB | N/A |
| edge-ssr-HASH.js gzip | 265 B | 266 B | N/A |
| head-HASH.js gzip | 364 B | 364 B | ✓ |
| hooks-HASH.js gzip | 392 B | 392 B | ✓ |
| image-HASH.js gzip | 4.41 kB | 4.41 kB | N/A |
| index-HASH.js gzip | 268 B | 268 B | ✓ |
| link-HASH.js gzip | 2.78 kB | 2.78 kB | N/A |
| routerDirect..HASH.js gzip | 327 B | 327 B | ✓ |
| script-HASH.js gzip | 397 B | 396 B | N/A |
| withRouter-HASH.js gzip | 321 B | 324 B | N/A |
| 1afbb74e6ecf..834.css gzip | 106 B | 106 B | ✓ |
| Overall change | 1.65 kB | 1.65 kB | ✓ |
Client Build Manifests
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| _buildManifest.js gzip | 751 B | 749 B | N/A |
| Overall change | 0 B | 0 B | ✓ |
Rendered Page Sizes
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| index.html gzip | 522 B | 523 B | N/A |
| link.html gzip | 537 B | 536 B | N/A |
| withRouter.html gzip | 518 B | 519 B | N/A |
| Overall change | 0 B | 0 B | ✓ |
Edge SSR bundle Size
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| edge-ssr.js gzip | 128 kB | 128 kB | N/A |
| page.js gzip | 188 kB | 187 kB | N/A |
| Overall change | 0 B | 0 B | ✓ |
Middleware size
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| middleware-b..fest.js gzip | 667 B | 668 B | N/A |
| middleware-r..fest.js gzip | 155 B | 156 B | N/A |
| middleware.js gzip | 31 kB | 31 kB | N/A |
| edge-runtime..pack.js gzip | 844 B | 844 B | ✓ |
| Overall change | 844 B | 844 B | ✓ |
Next Runtimes Overall increase ⚠️
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| 973-experime...dev.js gzip | 322 B | 322 B | ✓ |
| 973.runtime.dev.js gzip | 314 B | 314 B | ✓ |
| app-page-exp...dev.js gzip | 317 kB | 317 kB | N/A |
| app-page-exp..prod.js gzip | 121 kB | 121 kB | N/A |
| app-page-tur..prod.js gzip | 134 kB | 134 kB | N/A |
| app-page-tur..prod.js gzip | 129 kB | 129 kB | N/A |
| app-page.run...dev.js gzip | 308 kB | 308 kB | N/A |
| app-page.run..prod.js gzip | 117 kB | 117 kB | N/A |
| app-route-ex...dev.js gzip | 35.9 kB | 35.9 kB | N/A |
| app-route-ex..prod.js gzip | 24.4 kB | 24.4 kB | N/A |
| app-route-tu..prod.js gzip | 24.4 kB | 24.4 kB | N/A |
| app-route-tu..prod.js gzip | 24.2 kB | 24.2 kB | N/A |
| app-route.ru...dev.js gzip | 37.6 kB | 37.5 kB | N/A |
| app-route.ru..prod.js gzip | 24.2 kB | 24.2 kB | N/A |
| pages-api-tu..prod.js gzip | 9.61 kB | 9.61 kB | ✓ |
| pages-api.ru...dev.js gzip | 11.4 kB | 11.4 kB | ✓ |
| pages-api.ru..prod.js gzip | 9.61 kB | 9.61 kB | ✓ |
| pages-turbo...prod.js gzip | 20.9 kB | 20.9 kB | ✓ |
| pages.runtim...dev.js gzip | 26.5 kB | 26.5 kB | ✓ |
| pages.runtim..prod.js gzip | 20.9 kB | 20.9 kB | ✓ |
| server.runti..prod.js gzip | 58.4 kB | 914 kB | ⚠️ +855 kB |
| Overall change | 158 kB | 1.01 MB | ⚠️ +855 kB |
build cache
| vercel/next.js canary | vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ | Change | |
|---|---|---|---|
| 0.pack gzip | 1.85 MB | 1.85 MB | N/A |
| index.pack gzip | 143 kB | 143 kB | N/A |
| Overall change | 0 B | 0 B | ✓ |
Diff details
Diff for page.js
Diff too large to display
Diff for middleware.js
Diff too large to display
Diff for edge-ssr.js
Diff too large to display
Diff for image-HASH.js
@@ -1,7 +1,7 @@
(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
[8358],
{
- /***/ 4693: /***/ (
+ /***/ 7494: /***/ (
__unused_webpack_module,
__unused_webpack_exports,
__webpack_require__
@@ -9,7 +9,7 @@
(window.__NEXT_P = window.__NEXT_P || []).push([
"/image",
function () {
- return __webpack_require__(8698);
+ return __webpack_require__(9269);
},
]);
if (false) {
@@ -18,7 +18,7 @@
/***/
},
- /***/ 5928: /***/ (module, exports, __webpack_require__) => {
+ /***/ 245: /***/ (module, exports, __webpack_require__) => {
"use strict";
/* __next_internal_client_entry_do_not_use__ cjs */
Object.defineProperty(exports, "__esModule", {
@@ -40,17 +40,17 @@
__webpack_require__(1150)
);
const _head = /*#__PURE__*/ _interop_require_default._(
- __webpack_require__(2614)
+ __webpack_require__(6936)
);
- const _getimgprops = __webpack_require__(8958);
- const _imageconfig = __webpack_require__(1533);
- const _imageconfigcontextsharedruntime = __webpack_require__(2437);
- const _warnonce = __webpack_require__(9124);
- const _routercontextsharedruntime = __webpack_require__(5778);
+ const _getimgprops = __webpack_require__(1096);
+ const _imageconfig = __webpack_require__(8965);
+ const _imageconfigcontextsharedruntime = __webpack_require__(5280);
+ const _warnonce = __webpack_require__(857);
+ const _routercontextsharedruntime = __webpack_require__(9684);
const _imageloader = /*#__PURE__*/ _interop_require_default._(
- __webpack_require__(406)
+ __webpack_require__(2448)
);
- const _usemergedref = __webpack_require__(9782);
+ const _usemergedref = __webpack_require__(5493);
// This is replaced by webpack define plugin
const configEnv = {
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -371,7 +371,7 @@
/***/
},
- /***/ 9782: /***/ (module, exports, __webpack_require__) => {
+ /***/ 5493: /***/ (module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -432,7 +432,7 @@
/***/
},
- /***/ 8958: /***/ (
+ /***/ 1096: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -448,9 +448,9 @@
return getImgProps;
},
});
- const _warnonce = __webpack_require__(9124);
- const _imageblursvg = __webpack_require__(9846);
- const _imageconfig = __webpack_require__(1533);
+ const _warnonce = __webpack_require__(857);
+ const _imageblursvg = __webpack_require__(5681);
+ const _imageconfig = __webpack_require__(8965);
const VALID_LOADING_VALUES =
/* unused pure expression or super */ null && [
"lazy",
@@ -824,7 +824,7 @@
/***/
},
- /***/ 9846: /***/ (__unused_webpack_module, exports) => {
+ /***/ 5681: /***/ (__unused_webpack_module, exports) => {
"use strict";
/**
* A shared function, used on both client and server, to generate a SVG blur placeholder.
@@ -879,7 +879,7 @@
/***/
},
- /***/ 4951: /***/ (
+ /***/ 7398: /***/ (
__unused_webpack_module,
exports,
__webpack_require__
@@ -906,10 +906,10 @@
},
});
const _interop_require_default = __webpack_require__(9608);
- const _getimgprops = __webpack_require__(8958);
- const _imagecomponent = __webpack_require__(5928);
+ const _getimgprops = __webpack_require__(1096);
+ const _imagecomponent = __webpack_require__(245);
const _imageloader = /*#__PURE__*/ _interop_require_default._(
- __webpack_require__(406)
+ __webpack_require__(2448)
);
function getImageProps(imgProps) {
const { props } = (0, _getimgprops.getImgProps)(imgProps, {
@@ -941,7 +941,7 @@
/***/
},
- /***/ 406: /***/ (__unused_webpack_module, exports) => {
+ /***/ 2448: /***/ (__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", {
@@ -976,7 +976,7 @@
/***/
},
- /***/ 8698: /***/ (
+ /***/ 9269: /***/ (
__unused_webpack_module,
__webpack_exports__,
__webpack_require__
@@ -993,8 +993,8 @@
// EXTERNAL MODULE: ./node_modules/.pnpm/[email protected]/node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(1882);
- // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-28668d39-20241023_re_wbsj4g46sbkzmyvf32u2ztx36m/node_modules/next/image.js
- var next_image = __webpack_require__(477);
+ // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-28668d39-20241023_re_ygc4u4zbyids6gylg2elop7bza/node_modules/next/image.js
+ var next_image = __webpack_require__(8797);
var image_default = /*#__PURE__*/ __webpack_require__.n(next_image); // CONCATENATED MODULE: ./pages/nextjs.png
/* harmony default export */ const nextjs = {
src: "/_next/static/media/nextjs.cae0b805.png",
@@ -1024,12 +1024,12 @@
/***/
},
- /***/ 477: /***/ (
+ /***/ 8797: /***/ (
module,
__unused_webpack_exports,
__webpack_require__
) => {
- module.exports = __webpack_require__(4951);
+ module.exports = __webpack_require__(7398);
/***/
},
@@ -1039,7 +1039,7 @@
/******/ var __webpack_exec__ = (moduleId) =>
__webpack_require__((__webpack_require__.s = moduleId));
/******/ __webpack_require__.O(0, [2888, 9774, 179], () =>
- __webpack_exec__(4693)
+ __webpack_exec__(7494)
);
/******/ var __webpack_exports__ = __webpack_require__.O();
/******/ _N_E = __webpack_exports__;
Diff for 4172-HASH.js
Diff too large to display
Diff for main-HASH.js
Diff too large to display
Diff for app-page-exp..ntime.dev.js
failed to diff
Diff for app-page-exp..time.prod.js
Diff too large to display
Diff for app-page-tur..time.prod.js
Diff too large to display
Diff for app-page-tur..time.prod.js
Diff too large to display
Diff for app-page.runtime.dev.js
failed to diff
Diff for app-page.runtime.prod.js
Diff too large to display
Diff for app-route-ex..ntime.dev.js
Diff too large to display
Diff for app-route-ex..time.prod.js
Diff too large to display
Diff for app-route-tu..time.prod.js
Diff too large to display
Diff for app-route-tu..time.prod.js
Diff too large to display
Diff for app-route.runtime.dev.js
Diff too large to display
Diff for app-route.ru..time.prod.js
Diff too large to display
Diff for server.runtime.prod.js
failed to diff
Flaky test. Merging anyway.
Need to revert since source-map uses Math.random for quick-sort which triggers warnings with experimental.dynamicIO: https://github.com/vercel/next.js/pull/71868