mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(experience): update dev features flag env handling (#6467)
This commit is contained in:
parent
b549a7efd6
commit
54881078f1
2 changed files with 9 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
|||
import { yes } from '@silverhand/essentials';
|
||||
|
||||
const normalizeEnv = (value: unknown) =>
|
||||
value === null || value === undefined ? undefined : String(value);
|
||||
|
||||
const isProduction = import.meta.env.PROD;
|
||||
|
||||
export const isDevFeaturesEnabled =
|
||||
process.env.NODE_ENV !== 'production' || yes(process.env.DEV_FEATURES_ENABLED);
|
||||
!isProduction || yes(normalizeEnv(import.meta.env.DEV_FEATURES_ENABLED));
|
||||
|
|
|
@ -26,6 +26,9 @@ const buildConfig = (mode: string): UserConfig => ({
|
|||
viteCompression({ disable: mode === 'development' }),
|
||||
viteCompression({ disable: mode === 'development', algorithm: 'brotliCompress' }),
|
||||
],
|
||||
define: {
|
||||
'import.meta.env.DEV_FEATURES_ENABLED': JSON.stringify(process.env.DEV_FEATURES_ENABLED),
|
||||
},
|
||||
build: {
|
||||
// Use the same browserslist configuration as in README.md.
|
||||
// Consider using the esbuild target directly in the future.
|
||||
|
|
Loading…
Reference in a new issue