Chore: Allow source-maps to be enforced through an env variable

This commit is contained in:
Gustav Hansen 2023-07-26 15:42:33 +02:00
parent cccdae0db7
commit dd3ae14b0b
3 changed files with 5 additions and 1 deletions

View File

@ -31,6 +31,7 @@ async function build({ appDir, buildDestDir, env, forceBuild, optimize, options,
const dest = path.resolve(buildDestDir, 'build');
const pluginsPath = Object.keys(plugins).map((pluginName) => plugins[pluginName].pathToPlugin);
const enforceSourceMaps = process.env.STRAPI_ENFORCE_SOURCEMAPS === 'true' ?? false;
// Either use the tsconfig file from the generated app or the one inside the .cache folder
// so we can develop plugins in TS while being in a JS app
@ -42,6 +43,7 @@ async function build({ appDir, buildDestDir, env, forceBuild, optimize, options,
appDir,
cacheDir,
dest,
enforceSourceMaps,
entry,
env,
optimize,

View File

@ -54,6 +54,7 @@ const buildAdmin = async () => {
telemetryDisabled: process.env.STRAPI_TELEMETRY_DISABLED === 'true' ?? false,
},
tsConfigFilePath,
enforceSourceMaps: process.env.STRAPI_ENFORCE_SOURCEMAPS === 'true' ?? false,
};
const config =

View File

@ -28,6 +28,7 @@ module.exports = ({
features: [],
},
tsConfigFilePath,
enforceSourceMaps,
}) => {
const isProduction = env === 'production';
@ -54,7 +55,7 @@ module.exports = ({
return {
mode: isProduction ? 'production' : 'development',
bail: !!isProduction,
devtool: isProduction ? false : 'eval-source-map',
devtool: isProduction && !enforceSourceMaps ? false : 'source-map',
experiments: {
topLevelAwait: true,
},