Skip to content

Commit 30c2c0e

Browse files
fix(chrome-devtools): resolve TypeScript import errors causing CI failure
- Move @module-federation/runtime from devDependencies to dependencies - Add @module-federation/runtime-core as dependency for proper type resolution - Fix import paths from '@module-federation/runtime/types' to '@module-federation/runtime' - Update type annotations to use 'any' where Shared type is not directly accessible - Add __GLOBAL_PLUGIN__ property to Federation interface extension - Resolve parameter type issues with proper type annotations This fixes the CI build failure in the devtools workflow where TypeScript compilation was failing due to missing type declarations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e6398c3 commit 30c2c0e

File tree

6 files changed

+24
-44
lines changed

6 files changed

+24
-44
lines changed

packages/chrome-devtools/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
"dependencies": {
5757
"@arco-design/web-react": "^2.64.1",
5858
"@modern-js/runtime": "2.68.2",
59+
"@module-federation/runtime": "workspace:*",
60+
"@module-federation/runtime-core": "workspace:*",
5961
"@module-federation/sdk": "workspace:*",
6062
"ahooks": "^3.7.10",
6163
"dagre": "^0.8.5",
@@ -70,7 +72,6 @@
7072
"@modern-js/module-tools": "2.68.2",
7173
"@modern-js/storybook": "2.68.2",
7274
"@modern-js/tsconfig": "2.68.2",
73-
"@module-federation/runtime": "workspace:*",
7475
"@playwright/test": "1.49.1",
7576
"@types/chrome": "^0.0.272",
7677
"@types/dagre": "^0.7.52",

packages/chrome-devtools/src/init.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ declare global {
1010
declare module '@module-federation/runtime' {
1111
export interface Federation {
1212
originModuleInfo: GlobalModuleInfo;
13+
__GLOBAL_PLUGIN__?: any[];
1314
}
1415
}
1516

packages/chrome-devtools/src/utils/chrome/fast-refresh.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import type {
2-
ModuleFederationRuntimePlugin,
3-
Shared,
4-
} from '@module-federation/runtime/types';
1+
import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
52
import { loadScript } from '@module-federation/sdk';
63

74
import { isObject, getUnpkgUrl } from '../index';
@@ -11,7 +8,7 @@ import { __FEDERATION_DEVTOOLS__ } from '../../template';
118
const fastRefreshPlugin = (): ModuleFederationRuntimePlugin => {
129
return {
1310
name: 'mf-fast-refresh-plugin',
14-
beforeInit({ userOptions, ...args }) {
11+
beforeInit({ userOptions, ...args }: any) {
1512
const shareInfo = userOptions.shared;
1613
const twinsShareInfo = args.shareInfo;
1714
let enableFastRefresh: boolean;
@@ -34,11 +31,11 @@ const fastRefreshPlugin = (): ModuleFederationRuntimePlugin => {
3431
});
3532
Object.keys(shareInfo).forEach(async (share) => {
3633
// @ts-ignore legacy runtime shareInfo[share] is shared , and latest i shard[]
37-
const sharedArr: Shared[] = Array.isArray(shareInfo[share])
34+
const sharedArr: any[] = Array.isArray(shareInfo[share])
3835
? shareInfo[share]
3936
: [shareInfo[share]];
4037

41-
let twinsSharedArr: Shared[];
38+
let twinsSharedArr: any[];
4239
if (twinsShareInfo) {
4340
// @ts-ignore
4441
twinsSharedArr = Array.isArray(twinsShareInfo[share])

packages/chrome-devtools/src/utils/chrome/post-message.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import helpers from '@module-federation/runtime/helpers';
2-
import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
2+
import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
33

44
import { definePropertyGlobalVal } from '../sdk';
55

66
const getModuleInfo = (): ModuleFederationRuntimePlugin => {
77
return {
88
name: 'mf-devtool-getModuleInfo-plugin',
9-
loadRemoteSnapshot({ options, moduleInfo, remoteSnapshot, ...res }) {
9+
loadRemoteSnapshot({ options, moduleInfo, remoteSnapshot, ...res }: any) {
1010
const globalSnapshot = helpers.global.getGlobalSnapshot();
1111
if (!options || options.inBrowser) {
1212
window.postMessage(

packages/chrome-devtools/src/utils/chrome/snapshot-plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MODULE_DEVTOOL_IDENTIFIER } from '@module-federation/sdk';
22
import runtimeHelpers from '@module-federation/runtime/helpers';
33

4-
import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
4+
import type { ModuleFederationRuntimePlugin } from '@module-federation/runtime';
55

66
import { definePropertyGlobalVal } from '../sdk';
77

@@ -13,7 +13,7 @@ declare global {
1313
const chromeDevtoolsPlugin: () => ModuleFederationRuntimePlugin = function () {
1414
return {
1515
name: 'mf-chrome-devtools-inject-snapshot-plugin',
16-
beforeLoadRemoteSnapshot({ options }) {
16+
beforeLoadRemoteSnapshot({ options }: any) {
1717
const { nativeGlobal } = runtimeHelpers.global;
1818

1919
if (!options || options.inBrowser) {

pnpm-lock.yaml

Lines changed: 13 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)