mirror of
https://github.com/strapi/strapi.git
synced 2025-11-14 01:02:04 +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 dest = path.resolve(buildDestDir, 'build');
|
||||||
|
|
||||||
const pluginsPath = Object.keys(plugins).map((pluginName) => plugins[pluginName].pathToPlugin);
|
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
|
// 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
|
// 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,
|
appDir,
|
||||||
cacheDir,
|
cacheDir,
|
||||||
dest,
|
dest,
|
||||||
|
enforceSourceMaps,
|
||||||
entry,
|
entry,
|
||||||
env,
|
env,
|
||||||
optimize,
|
optimize,
|
||||||
|
|||||||
@ -54,6 +54,7 @@ const buildAdmin = async () => {
|
|||||||
telemetryDisabled: process.env.STRAPI_TELEMETRY_DISABLED === 'true' ?? false,
|
telemetryDisabled: process.env.STRAPI_TELEMETRY_DISABLED === 'true' ?? false,
|
||||||
},
|
},
|
||||||
tsConfigFilePath,
|
tsConfigFilePath,
|
||||||
|
enforceSourceMaps: process.env.STRAPI_ENFORCE_SOURCEMAPS === 'true' ?? false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const config =
|
const config =
|
||||||
|
|||||||
@ -28,6 +28,7 @@ module.exports = ({
|
|||||||
features: [],
|
features: [],
|
||||||
},
|
},
|
||||||
tsConfigFilePath,
|
tsConfigFilePath,
|
||||||
|
enforceSourceMaps,
|
||||||
}) => {
|
}) => {
|
||||||
const isProduction = env === 'production';
|
const isProduction = env === 'production';
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ module.exports = ({
|
|||||||
return {
|
return {
|
||||||
mode: isProduction ? 'production' : 'development',
|
mode: isProduction ? 'production' : 'development',
|
||||||
bail: !!isProduction,
|
bail: !!isProduction,
|
||||||
devtool: isProduction ? false : 'eval-source-map',
|
devtool: isProduction && !enforceSourceMaps ? false : 'source-map',
|
||||||
experiments: {
|
experiments: {
|
||||||
topLevelAwait: true,
|
topLevelAwait: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user