Skip to content

Commit

Permalink
fix: bad env NODE_ENVIRONMENT (#5766)
Browse files Browse the repository at this point in the history
Сломалась сборка в vite из-за переменной.
Переименовываем `NODE_ENVIRONMENT` в `NODE_ENV` и фиксируем в типах
  • Loading branch information
SevereCloud authored and actions-user committed Sep 10, 2023
1 parent ae0900b commit 5ac27d5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const AdaptivityProvider = ({
const LEGACY_bridge = useBridgeAdaptivity(LEGACY_disableInternalUseBridgeAdaptivity);
/* eslint-enable @typescript-eslint/naming-convention */

if (process.env.NODE_ENVIRONMENT === 'development') {
if (process.env.NODE_ENV === 'development') {
// TODO [>=6]: удалить warn
if (!LEGACY_disableInternalUseBridgeAdaptivity) {
warn("[@vkontakte/vk-bridge] Интеграция VKUI с @vkontakte/vk-bridge устарела и будет удалена в v6. Используйте хук `useAdaptivity()` из @vkontakte/vk-bridge-react и результат передайте в компонент (см. https://github.com/VKCOM/VKUI/issues/5049)"); // prettier-ignore
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/AppRoot/AppRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const AppRoot = ({

const { hasPointer, sizeX = 'none' } = useAdaptivity();

if (process.env.NODE_ENVIRONMENT === 'development') {
if (process.env.NODE_ENV === 'development') {
if (!safeAreaInsets) {
// TODO [>=6]: удалить warn
warn("[@vkontakte/vk-bridge] Интеграция VKUI с @vkontakte/vk-bridge устарела и будет удалена в v6. Используйте хук `useInsets()` из @vkontakte/vk-bridge-react и результат передайте в параметр `safeAreaInsets` (см. https://github.com/VKCOM/VKUI/issues/5049)"); // prettier-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const ConfigProvider = (props: ConfigProviderProps) => {
? props.webviewType === WebviewType.VKAPPS
: hasCustomPanelHeaderAfterMerged;

if (process.env.NODE_ENVIRONMENT === 'development') {
if (process.env.NODE_ENV === 'development') {
// TODO [>=6]: удалить warn
let webviewTypeRule = '';
if (props.webviewType) {
Expand Down
13 changes: 13 additions & 0 deletions packages/vkui/types/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ declare module '*.module.css' {
}

declare module '*.svg';

// Фиксируем process.env, так как vite передает только NODE_ENV
declare module 'process' {
declare global {
namespace NodeJS {
interface Process {
env: {
NODE_ENV: 'development' | 'production' | 'test';
};
}
}
}
}

0 comments on commit 5ac27d5

Please sign in to comment.