@umijs/plugins 4.2.6-alpha.6 → 4.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,7 +65,7 @@ export default function InitialStateProvider(props: any) {
65
65
  appLoaded.current = true;
66
66
  }
67
67
  }, [loading]);
68
- if (loading && !appLoaded.current && typeof window !== 'undefined') {
68
+ if (loading && !appLoaded.current) {
69
69
  return <Loading />;
70
70
  }
71
71
  return props.children;
@@ -219,16 +219,6 @@ export { MicroAppWithMemoHistory } from './MicroAppWithMemoHistory';
219
219
  `
220
220
  });
221
221
  });
222
- api.chainWebpack((config, { ssr }) => {
223
- if (ssr) {
224
- const originalExternals = config.get("externals");
225
- config.externals({
226
- ...originalExternals,
227
- qiankun: "fs"
228
- });
229
- }
230
- return config;
231
- });
232
222
  };
233
223
  // Annotate the CommonJS export names for ESM import in node:
234
224
  0 && (module.exports = {
@@ -171,10 +171,7 @@ export interface IRuntimeConfig {
171
171
  `window.publicPath = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "${api.config.publicPath || "/"}";`
172
172
  ];
173
173
  });
174
- api.chainWebpack((config, { ssr }) => {
175
- if (ssr) {
176
- return;
177
- }
174
+ api.chainWebpack((config) => {
178
175
  (0, import_assert.default)(api.pkg.name, "You should have name in package.json.");
179
176
  const {
180
177
  shouldNotAddLibraryChunkName = api.env === "production" || !Boolean(api.config.mfsu)
@@ -204,14 +201,11 @@ export interface IRuntimeConfig {
204
201
  });
205
202
  api.addEntryCode(() => [
206
203
  `
207
- const qiankun_noop = () => new Error('qiankun lifecycle is not available for server runtime!');
208
- const isServer = typeof window === 'undefined';
209
- export const bootstrap = isServer ? qiankun_noop: qiankun_genBootstrap(render);
210
- export const mount = isServer ? qiankun_noop : qiankun_genMount('${api.config.mountElementId}');
211
- export const unmount = isServer ? qiankun_noop : qiankun_genUnmount('${api.config.mountElementId}');
212
- export const update = isServer ? qiankun_noop : qiankun_genUpdate();
213
- // 增加 ssr 的判断
214
- if (!isServer && !window.__POWERED_BY_QIANKUN__) {
204
+ export const bootstrap = qiankun_genBootstrap(render);
205
+ export const mount = qiankun_genMount('${api.config.mountElementId}');
206
+ export const unmount = qiankun_genUnmount('${api.config.mountElementId}');
207
+ export const update = qiankun_genUpdate();
208
+ if (!window.__POWERED_BY_QIANKUN__) {
215
209
  bootstrap().then(mount);
216
210
  }
217
211
  `
@@ -77,10 +77,6 @@ function patchMicroAppRouteComponent(routes: any[]) {
77
77
  }
78
78
 
79
79
  export async function render(oldRender: typeof noop) {
80
- // 在 ssr 的场景下,直接返回旧的 render
81
- if (typeof window === 'undefined') {
82
- return oldRender();
83
- }
84
80
  const runtimeOptions = await getMasterRuntime();
85
81
  let masterOptions: MasterOptions = {
86
82
  ...getMasterOptions(),
@@ -142,10 +138,6 @@ export async function render(oldRender: typeof noop) {
142
138
  }
143
139
 
144
140
  export function patchClientRoutes({ routes }: { routes: any[] }) {
145
- // 在 ssr 的场景下,不执行主应用的 patchClientRoutes
146
- if (typeof window === 'undefined') {
147
- return;
148
- }
149
141
  const microAppRoutes = [].concat(
150
142
  deepFilterLeafRoutes(routes),
151
143
  deepFilterLeafRoutes(microAppRuntimeRoutes),
@@ -3,10 +3,6 @@ import { createHistory } from '@@/core/history';
3
3
  import qiankunRender, { contextOptsStack } from './lifecycles';
4
4
 
5
5
  export function render(oldRender: any) {
6
- // 在 ssr 的场景下,直接返回旧的 render
7
- if (typeof window === 'undefined') {
8
- return oldRender();
9
- }
10
6
  return qiankunRender().then(oldRender);
11
7
  }
12
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.2.6-alpha.6",
3
+ "version": "4.2.6",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -45,12 +45,12 @@
45
45
  "styled-components": "6.1.1",
46
46
  "tslib": "^2",
47
47
  "warning": "^4.0.3",
48
- "@umijs/bundler-utils": "4.2.6-alpha.6",
48
+ "@umijs/bundler-utils": "4.2.6",
49
49
  "@umijs/valtio": "1.0.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "antd": "^4.24.1",
53
- "umi": "4.2.6-alpha.6"
53
+ "umi": "4.2.6"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"