Skip to content

🎥 Make videos programmatically with React

Obfuscate window.env.process.NODE_ENV

Jonny Burger62f339d82ec2
diff --git a/packages/core/src/get-remotion-environment.ts b/packages/core/src/get-remotion-environment.ts
index dbae87b2c4..f2eca95ec3 100644
--- a/packages/core/src/get-remotion-environment.ts
+++ b/packages/core/src/get-remotion-environment.ts
@@ -4,6 +4,15 @@ export type RemotionEnvironment = {
isPlayer: boolean;
};
+// Avoid VITE obfuscation
+function getNodeEnvString() {
+ return ['NOD', 'E_EN', 'V'].join('');
+}
+
+const getEnvString = (): 'env' => {
+ return ['e', 'nv'].join('') as 'env';
+};
+
/**
* @description Provides information about the Remotion Environment
* @see [Documentation](https://www.remotion.dev/docs/get-remotion-environment)
@@ -14,8 +23,8 @@ export const getRemotionEnvironment = (): RemotionEnvironment => {
typeof window !== 'undefined' &&
typeof window.process !== 'undefined' &&
typeof window.process.env !== 'undefined' &&
- (window.process.env.NODE_ENV === 'test' ||
- (window.process.env.NODE_ENV === 'production' &&
+ (window.process[getEnvString()][getNodeEnvString()] === 'test' ||
+ (window.process[getEnvString()][getNodeEnvString()] === 'production' &&
typeof window !== 'undefined' &&
typeof window.remotion_puppeteerTimeout !== 'undefined'));
const isStudio = typeof window !== 'undefined' && window.remotion_isStudio;