cli: Use yn to parse env for build cache

Signed-off-by: Marcus Eide <eide@spotify.com>
This commit is contained in:
Marcus Eide
2022-12-13 16:26:01 +01:00
parent 4b572126f1
commit c54ff49fee
+4 -1
View File
@@ -35,6 +35,7 @@ import { paths as cliPaths } from '../../lib/paths';
import { runPlain } from '../run';
import ESLintPlugin from 'eslint-webpack-plugin';
import pickBy from 'lodash/pickBy';
import yn from 'yn';
const BUILD_CACHE_ENV_VAR = 'BACKSTAGE_CLI_EXPERIMENTAL_BUILD_CACHE';
@@ -148,6 +149,8 @@ export async function createConfig(
require.resolve('react-refresh'),
];
const withCache = yn(process.env[BUILD_CACHE_ENV_VAR], { default: false });
return {
mode: isDev ? 'development' : 'production',
profile: false,
@@ -208,7 +211,7 @@ export async function createConfig(
: {}),
},
plugins,
...(process.env[BUILD_CACHE_ENV_VAR]
...(withCache
? {
cache: {
type: 'filesystem',