fix: HRM in dev
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
||||
import { defineConfig } from '@umijs/max';
|
||||
import keepAlive from './keep-alive';
|
||||
import { extraMfsuExclude } from './mfsu.extensions';
|
||||
import { compressionPluginConfig, monacoPluginConfig } from './plugins';
|
||||
import proxy from './proxy';
|
||||
import routes from './routes';
|
||||
@@ -32,7 +33,7 @@ export default defineConfig({
|
||||
defaultSizes: 'parsed' // stat // gzip
|
||||
},
|
||||
mfsu: {
|
||||
exclude: ['lodash', 'ml-pca']
|
||||
exclude: ['lodash', 'ml-pca', ...extraMfsuExclude]
|
||||
},
|
||||
base: process.env.npm_config_base || '/',
|
||||
...(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
|
||||
// needs to.
|
||||
context?: Record<string, any>;
|
||||
}> = ({ name, context }) => {
|
||||
[key: string]: any;
|
||||
}> = ({ name, context, ...rest }) => {
|
||||
const Slot = getGPUStackPlugin()?.components?.[name];
|
||||
if (!Slot) {
|
||||
return null;
|
||||
}
|
||||
return <Slot context={context} />;
|
||||
return <Slot context={context} {...rest} />;
|
||||
};
|
||||
|
||||
export default PluginExtraFields;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GPUStackVersionAtom, UpdateCheckAtom } from '@/atoms/user';
|
||||
import PluginExtraField from '@/components/plugin-extra-fields';
|
||||
import VersionInfo, { modalConfig } from '@/components/version-info';
|
||||
import externalLinks from '@/constants/external-links';
|
||||
import useBodyScroll from '@/hooks/use-body-scroll';
|
||||
import { logout } from '@/pages/login/apis';
|
||||
import { getGPUStackPlugin } from '@/plugins';
|
||||
import { useModel } from '@@/plugin-model';
|
||||
import {
|
||||
DiscordOutlined,
|
||||
@@ -19,15 +19,6 @@ import { useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
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`
|
||||
position: relative;
|
||||
top: -4px;
|
||||
@@ -106,7 +97,6 @@ const CustomItem = styled.div`
|
||||
|
||||
export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
||||
const { isDarkTheme } = props;
|
||||
const pluginManager = getGPUStackPlugin();
|
||||
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
|
||||
const [modal, contextHolder] = Modal.useModal();
|
||||
const [version] = useAtom(GPUStackVersionAtom);
|
||||
@@ -119,8 +109,6 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
||||
};
|
||||
|
||||
const { initialState } = initialInfo;
|
||||
const { GlobalSettings, OrgSwitcher } = pluginManager?.components || {};
|
||||
console.log('plugin+++++++++', pluginManager);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -271,7 +259,7 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
||||
return (
|
||||
<Wrapper>
|
||||
{contextHolder}
|
||||
{OrgSwitcher && <OrgSwitcher isDarkTheme={isDarkTheme} />}
|
||||
<PluginExtraField name="OrgSwitcher" isDarkTheme={isDarkTheme} />
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
@@ -305,7 +293,7 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
||||
/>
|
||||
</IconWrapper>
|
||||
</DropdownActions>
|
||||
{GlobalSettings && <GlobalSettings></GlobalSettings>}
|
||||
<PluginExtraField name="GlobalSettings" />
|
||||
<DropdownActions menu={{ ...userMenu }} popupRender={userPopupRender}>
|
||||
<IconWrapper>
|
||||
<Avatar
|
||||
|
||||
@@ -112,10 +112,10 @@ const Login = () => {
|
||||
const [initialPassword, setInitialPassword] = useAtom(initialPasswordAtom);
|
||||
const { initialState, setInitialState } = useModel('@@initialState') || {};
|
||||
|
||||
const enterprisePlugin = getGPUStackPlugin();
|
||||
const plugin = getGPUStackPlugin();
|
||||
|
||||
const CustomLoginComponent = enterprisePlugin?.login?.CustomLoginComponent;
|
||||
const shouldUseCustomLogin = enterprisePlugin?.login?.shouldUseCustomLogin;
|
||||
const CustomLoginComponent = plugin?.login?.CustomLoginComponent;
|
||||
const shouldUseCustomLogin = plugin?.login?.shouldUseCustomLogin;
|
||||
|
||||
const useCustomLogin = useMemo(
|
||||
() => shouldUseCustomLogin?.(userSettings),
|
||||
@@ -197,7 +197,7 @@ const Login = () => {
|
||||
token: {
|
||||
...themeData?.token,
|
||||
colorPrimary:
|
||||
enterprisePlugin?.getPrimaryColor?.(userSettings)?.colorPrimary ||
|
||||
plugin?.getPrimaryColor?.(userSettings)?.colorPrimary ||
|
||||
COLOR_PRIMARY
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user