mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
Chore: Allow source-maps to be enforced through an env variable
This commit is contained in:
parent
cccdae0db7
commit
dd3ae14b0b
@ -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,
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user