From 82cd7f7df17337e2cc43cc34a24859521beeb62d Mon Sep 17 00:00:00 2001 From: "Gabriel J. Csapo" Date: Mon, 19 Dec 2022 10:16:12 -0800 Subject: [PATCH] feat: adds a environment variable to opt out of source maps --- packages/fastboot/README.md | 2 ++ packages/fastboot/src/ember-app.js | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/fastboot/README.md b/packages/fastboot/README.md index 1aea48f26..e416a8edc 100644 --- a/packages/fastboot/README.md +++ b/packages/fastboot/README.md @@ -60,6 +60,8 @@ FastBoot.distPath // readOnly accessor that provides the dist path for the curre ### Additional configuration +> By default source maps are enabled by the source-maps-support package. Setting an environment variable `FASTBOOT_SOURCEMAPS_DISABLE=true` will bypass this package effectively disabling source maps support. + `app.visit` takes a second parameter as `options` above which a map and allows to define additional optional per request configuration: diff --git a/packages/fastboot/src/ember-app.js b/packages/fastboot/src/ember-app.js index 91c12ca44..5436bc85d 100644 --- a/packages/fastboot/src/ember-app.js +++ b/packages/fastboot/src/ember-app.js @@ -54,10 +54,14 @@ class EmberApp { this.config = allConfig; } - this.scripts = buildScripts([ - require.resolve('./scripts/install-source-map-support'), - ...config.scripts, - ]); + if (process.env.FASTBOOT_SOURCEMAPS_DISABLE) { + this.scripts = buildScripts([...config.scripts]); + } else { + this.scripts = buildScripts([ + require.resolve('./scripts/install-source-map-support'), + ...config.scripts, + ]); + } // default to 1 if maxSandboxQueueSize is not defined so the sandbox is pre-warmed when process comes up const maxSandboxQueueSize = options.maxSandboxQueueSize || 1;