From a9b2de8068e1704de91ee9df1acb3e180e771012 Mon Sep 17 00:00:00 2001 From: David E Disch Date: Tue, 20 Sep 2022 17:55:26 +1000 Subject: [PATCH] feat(gatsby): Enable source maps when compiling Gatsby files in development (#36450) --- docs/docs/debugging-the-build-process.md | 16 ++++++++++++++++ .../src/utils/parcel/compile-gatsby-files.ts | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/docs/debugging-the-build-process.md b/docs/docs/debugging-the-build-process.md index b4d0c99ace68b..fbf8de6add616 100644 --- a/docs/docs/debugging-the-build-process.md +++ b/docs/docs/debugging-the-build-process.md @@ -95,6 +95,10 @@ We won't go in depth here about how to debug in VS Code - for that you can check "request": "launch", "program": "${workspaceRoot}/node_modules/.bin/gatsby", "args": ["develop"], + "env": { + "PARCEL_WORKERS": "0", + "GATSBY_CPU_COUNT": "1", + }, "runtimeArgs": ["--nolazy"], "console": "integratedTerminal" }, @@ -104,6 +108,10 @@ We won't go in depth here about how to debug in VS Code - for that you can check "request": "launch", "program": "${workspaceRoot}/node_modules/.bin/gatsby", "args": ["build"], + "env": { + "PARCEL_WORKERS": "0", + "GATSBY_CPU_COUNT": "1", + }, "runtimeArgs": ["--nolazy"], "console": "integratedTerminal" } @@ -126,6 +134,10 @@ We won't go in depth here about how to debug in VS Code - for that you can check "program": "${workspaceRoot}/node_modules/gatsby/dist/bin/gatsby" }, "args": ["develop"], + "env": { + "PARCEL_WORKERS": "0", + "GATSBY_CPU_COUNT": "1", + }, "runtimeArgs": ["--nolazy"], "console": "integratedTerminal" }, @@ -138,6 +150,10 @@ We won't go in depth here about how to debug in VS Code - for that you can check "program": "${workspaceRoot}/node_modules/gatsby/dist/bin/gatsby" }, "args": ["build"], + "env": { + "PARCEL_WORKERS": "0", + "GATSBY_CPU_COUNT": "1", + }, "runtimeArgs": ["--nolazy"], "console": "integratedTerminal" } diff --git a/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts b/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts index ec3de4a5ca38a..613b27a445065 100644 --- a/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts +++ b/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts @@ -41,7 +41,7 @@ export function constructParcel(siteRoot: string, cache?: Cache): Parcel { root: { outputFormat: `commonjs`, includeNodeModules: false, - sourceMap: false, + sourceMap: process.env.NODE_ENV === `development`, engines: { node: _CFLAGS_.GATSBY_MAJOR === `5` ? `>= 18.0.0` : `>= 14.15.0`, },