Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/icestark/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

## [2.8.5] - 2026-02-11

### Added
- Added `independent` configuration option to `RuntimeConfig` interface
- Added smart loading strategy for runtime dependencies

### Changed
- Enhanced `loaded` logic for runtime libraries with whitelist support
- Updated whitelist libraries to use proper casing: 'React', 'ReactDOM'
- Improved dependency loading for libraries that require React/ReactDOM re-initialization

### Fixed
- Fixed runtime library loading strategy to properly handle independent dependencies
- Fixed version instance caching for non-whitelist libraries

## [2.8.4] - Previous releases
- See git history for previous changes
2 changes: 1 addition & 1 deletion packages/icestark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/stark",
"version": "2.8.4",
"version": "2.8.5",
"description": "Icestark is a JavaScript library for multiple projects, Ice workbench solution.",
"scripts": {
"build": "rm -rf lib && tsc",
Expand Down
21 changes: 20 additions & 1 deletion packages/icestark/src/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export interface RuntimeConfig {
url: string | string[];
library: string;
version: string;
/** Force reload even if versioned instance exists */
independent?: boolean;
}

export interface BaseConfig extends PathOption {
Expand Down Expand Up @@ -114,6 +116,23 @@ function getAppNames() {
return microApps.map((app) => app.name);
}

function isRuntimeLibraryLoaded(config: RuntimeConfig): boolean {
if (config.independent) {
return false;
}

const hasVersionedInstance = Boolean(
config.version &&
config.library &&
window[`${config.library}@${config.version}`],
);

const whitelistLibraries = ['React', 'ReactDOM'];
const isWhitelisted = whitelistLibraries.includes(config.library);

return isWhitelisted ? hasVersionedInstance : false;
}

export function getMicroApps() {
return microApps;
}
Expand Down Expand Up @@ -250,7 +269,7 @@ export async function loadAppModule(appConfig: AppConfig) {
return {
content: mainJs,
type: AssetTypeEnum.RUNTIME,
loaded: Boolean(config.version && config.library && window[`${config.library}@${config.version}`]),
loaded: isRuntimeLibraryLoaded(config),
library: config.library,
version: config.version,
};
Expand Down
Loading