From aaee535e5418253ff42eb1781fe0a9e15a538b95 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Thu, 17 Aug 2023 00:16:05 +0100 Subject: [PATCH] Remove `sourcesContent` from source maps unless bundled --- shared/tasks/scripts.mjs | 3 ++- shared/tasks/styles.mjs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shared/tasks/scripts.mjs b/shared/tasks/scripts.mjs index 4bb573d56f..f0b77a1c82 100644 --- a/shared/tasks/scripts.mjs +++ b/shared/tasks/scripts.mjs @@ -91,7 +91,8 @@ export async function compileJavaScript([ preserveModulesRoot: relative(basePath, srcPath), // Enable source maps - sourcemap: true + sourcemap: true, + sourcemapExcludeSources: !!output.preserveModules }) }) ) diff --git a/shared/tasks/styles.mjs b/shared/tasks/styles.mjs index acff0bf22b..1e33008c00 100644 --- a/shared/tasks/styles.mjs +++ b/shared/tasks/styles.mjs @@ -71,7 +71,8 @@ export async function compileStylesheet([ */ map: { annotation: true, - inline: false + inline: false, + sourcesContent: false } } @@ -114,6 +115,7 @@ export async function compileStylesheet([ // Pass source maps to PostCSS if (typeof options.map === 'object') { options.map.prev = map + options.map.sourcesContent = true } }