You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Obtains the `share` dependency. When a "shared" dependency matching the current consumer exists in the global environment, the existing and eligible dependency will be reused first. Otherwise, it loads its own dependency and stores it in the global cache.
177
148
- This `API` is usually not called directly by users but is used by the build plugin to convert its own dependencies.
178
149
150
+
```typescript
151
+
typeShareInfos= {
152
+
// The name of the dependency, basic information about the dependency, and sharing strategy
153
+
[pkgName:string]:Shared[];
154
+
};
155
+
156
+
typeShared= {
157
+
// The version of the shared dependency
158
+
version:string;
159
+
// Which modules are currently consuming this dependency
160
+
useIn:Array<string>;
161
+
// From which module does the shared dependency come?
162
+
from:string;
163
+
// Factory function to get the shared dependency instance. When no other existing dependencies, it will load its own shared dependencies.
164
+
lib?: () =>Module;
165
+
// Sharing strategy, which strategy will be used to decide whether to reuse the dependency
166
+
shareConfig:SharedConfig;
167
+
// The scope where the shared dependency is located, the default value is default
168
+
scope:Array<string>;
169
+
// Function to retrieve the shared dependency instance.
170
+
get:SharedGetter;
171
+
// List of dependencies that this shared module depends on
172
+
deps:Array<string>;
173
+
// Indicates whether the shared dependency has been loaded
174
+
loaded?:boolean;
175
+
// Represents the loading state of the shared dependency
176
+
loading?:null|Promise<any>;
177
+
// Determines if the shared dependency should be loaded eagerly
0 commit comments