fix: HRM in dev
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
import { defineConfig } from '@umijs/max';
|
import { defineConfig } from '@umijs/max';
|
||||||
import keepAlive from './keep-alive';
|
import keepAlive from './keep-alive';
|
||||||
|
import { extraMfsuExclude } from './mfsu.extensions';
|
||||||
import { compressionPluginConfig, monacoPluginConfig } from './plugins';
|
import { compressionPluginConfig, monacoPluginConfig } from './plugins';
|
||||||
import proxy from './proxy';
|
import proxy from './proxy';
|
||||||
import routes from './routes';
|
import routes from './routes';
|
||||||
@@ -32,7 +33,7 @@ export default defineConfig({
|
|||||||
defaultSizes: 'parsed' // stat // gzip
|
defaultSizes: 'parsed' // stat // gzip
|
||||||
},
|
},
|
||||||
mfsu: {
|
mfsu: {
|
||||||
exclude: ['lodash', 'ml-pca']
|
exclude: ['lodash', 'ml-pca', ...extraMfsuExclude]
|
||||||
},
|
},
|
||||||
base: process.env.npm_config_base || '/',
|
base: process.env.npm_config_base || '/',
|
||||||
...(isProduction
|
...(isProduction
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// Identity hook for build-time mfsu.exclude extensions. Tooling may
|
||||||
|
// overwrite this file to add package names that must skip MFSU's
|
||||||
|
// pre-bundling; the original is restored on cleanup. Mirrors
|
||||||
|
// `src/request.extensions.ts` / `src/access.extensions.ts`.
|
||||||
|
//
|
||||||
|
// MFSU bundles node_modules into immutable chunks at dev startup, so
|
||||||
|
// workspace-linked packages whose source you edit during dev must be
|
||||||
|
// excluded here or HMR won't pick up changes.
|
||||||
|
export const extraMfsuExclude: string[] = [];
|
||||||
@@ -16,12 +16,13 @@ const PluginExtraFields: React.FC<{
|
|||||||
// form-specific slot can pass its action / record context if it
|
// form-specific slot can pass its action / record context if it
|
||||||
// needs to.
|
// needs to.
|
||||||
context?: Record<string, any>;
|
context?: Record<string, any>;
|
||||||
}> = ({ name, context }) => {
|
[key: string]: any;
|
||||||
|
}> = ({ name, context, ...rest }) => {
|
||||||
const Slot = getGPUStackPlugin()?.components?.[name];
|
const Slot = getGPUStackPlugin()?.components?.[name];
|
||||||
if (!Slot) {
|
if (!Slot) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return <Slot context={context} />;
|
return <Slot context={context} {...rest} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default PluginExtraFields;
|
export default PluginExtraFields;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { GPUStackVersionAtom, UpdateCheckAtom } from '@/atoms/user';
|
import { GPUStackVersionAtom, UpdateCheckAtom } from '@/atoms/user';
|
||||||
|
import PluginExtraField from '@/components/plugin-extra-fields';
|
||||||
import VersionInfo, { modalConfig } from '@/components/version-info';
|
import VersionInfo, { modalConfig } from '@/components/version-info';
|
||||||
import externalLinks from '@/constants/external-links';
|
import externalLinks from '@/constants/external-links';
|
||||||
import useBodyScroll from '@/hooks/use-body-scroll';
|
import useBodyScroll from '@/hooks/use-body-scroll';
|
||||||
import { logout } from '@/pages/login/apis';
|
import { logout } from '@/pages/login/apis';
|
||||||
import { getGPUStackPlugin } from '@/plugins';
|
|
||||||
import { useModel } from '@@/plugin-model';
|
import { useModel } from '@@/plugin-model';
|
||||||
import {
|
import {
|
||||||
DiscordOutlined,
|
DiscordOutlined,
|
||||||
@@ -19,15 +19,6 @@ import { useMemo } from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { DEFAULT_ENTER_PAGE } from '../config/settings';
|
import { DEFAULT_ENTER_PAGE } from '../config/settings';
|
||||||
|
|
||||||
const UpdateDot = styled.span`
|
|
||||||
margin-left: 5px;
|
|
||||||
display: flex;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: var(--ant-orange-5);
|
|
||||||
`;
|
|
||||||
|
|
||||||
const NewLabel = styled.span`
|
const NewLabel = styled.span`
|
||||||
position: relative;
|
position: relative;
|
||||||
top: -4px;
|
top: -4px;
|
||||||
@@ -106,7 +97,6 @@ const CustomItem = styled.div`
|
|||||||
|
|
||||||
export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
||||||
const { isDarkTheme } = props;
|
const { isDarkTheme } = props;
|
||||||
const pluginManager = getGPUStackPlugin();
|
|
||||||
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
|
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
|
||||||
const [modal, contextHolder] = Modal.useModal();
|
const [modal, contextHolder] = Modal.useModal();
|
||||||
const [version] = useAtom(GPUStackVersionAtom);
|
const [version] = useAtom(GPUStackVersionAtom);
|
||||||
@@ -119,8 +109,6 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const { initialState } = initialInfo;
|
const { initialState } = initialInfo;
|
||||||
const { GlobalSettings, OrgSwitcher } = pluginManager?.components || {};
|
|
||||||
console.log('plugin+++++++++', pluginManager);
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -271,7 +259,7 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
|||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{contextHolder}
|
{contextHolder}
|
||||||
{OrgSwitcher && <OrgSwitcher isDarkTheme={isDarkTheme} />}
|
<PluginExtraField name="OrgSwitcher" isDarkTheme={isDarkTheme} />
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -305,7 +293,7 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
|||||||
/>
|
/>
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
</DropdownActions>
|
</DropdownActions>
|
||||||
{GlobalSettings && <GlobalSettings></GlobalSettings>}
|
<PluginExtraField name="GlobalSettings" />
|
||||||
<DropdownActions menu={{ ...userMenu }} popupRender={userPopupRender}>
|
<DropdownActions menu={{ ...userMenu }} popupRender={userPopupRender}>
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<Avatar
|
<Avatar
|
||||||
|
|||||||
@@ -112,10 +112,10 @@ const Login = () => {
|
|||||||
const [initialPassword, setInitialPassword] = useAtom(initialPasswordAtom);
|
const [initialPassword, setInitialPassword] = useAtom(initialPasswordAtom);
|
||||||
const { initialState, setInitialState } = useModel('@@initialState') || {};
|
const { initialState, setInitialState } = useModel('@@initialState') || {};
|
||||||
|
|
||||||
const enterprisePlugin = getGPUStackPlugin();
|
const plugin = getGPUStackPlugin();
|
||||||
|
|
||||||
const CustomLoginComponent = enterprisePlugin?.login?.CustomLoginComponent;
|
const CustomLoginComponent = plugin?.login?.CustomLoginComponent;
|
||||||
const shouldUseCustomLogin = enterprisePlugin?.login?.shouldUseCustomLogin;
|
const shouldUseCustomLogin = plugin?.login?.shouldUseCustomLogin;
|
||||||
|
|
||||||
const useCustomLogin = useMemo(
|
const useCustomLogin = useMemo(
|
||||||
() => shouldUseCustomLogin?.(userSettings),
|
() => shouldUseCustomLogin?.(userSettings),
|
||||||
@@ -197,7 +197,7 @@ const Login = () => {
|
|||||||
token: {
|
token: {
|
||||||
...themeData?.token,
|
...themeData?.token,
|
||||||
colorPrimary:
|
colorPrimary:
|
||||||
enterprisePlugin?.getPrimaryColor?.(userSettings)?.colorPrimary ||
|
plugin?.getPrimaryColor?.(userSettings)?.colorPrimary ||
|
||||||
COLOR_PRIMARY
|
COLOR_PRIMARY
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user