-
-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathindex.js
More file actions
49 lines (44 loc) · 1.54 KB
/
Copy pathindex.js
File metadata and controls
49 lines (44 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Module Federation support for Mockup.
*
* In this module federation setup Mockup is the main host, which loads other
* "remote" bundles.
*
* Those remotes need to be registered via the Patternslib's Webpack Module
* Federation helper, just like Mockup itself (See Mockup's webpack.config.js).
* Patternslib' Module Federation helper registers the bundle under a prefix
* (``MF_NAME_PREFIX``) in the global namespace.
*
* Here, we filter for all the globally registered bundles with this prefix and
* load them.
*
* Note: loading in this context only means that the module federation
* functionality for each bundle is initialized.
*
*/
import "@patternslib/dev/webpack/module_federation";
// And now load this bundle's actual entry point.
import("./patterns");
// Register Bootstrap and jQuery gloablly
async function register_global_libraries() {
// Register Bootstrap globally
const bootstrap = await import("bootstrap");
window.bootstrap = bootstrap;
// Register jQuery globally
const jquery = (await import("jquery")).default;
// BBB: jQuery4 backports for select2
jquery.isFunction = function (obj) {
return typeof obj === "function";
};
jquery.isArray = function (obj) {
return Array.isArray
? Array.isArray(obj)
: Object.prototype.toString.call(obj) === "[object Array]";
};
jquery.trim = function (str) {
return str == null ? "" : String.prototype.trim.call(str);
};
window.jQuery = jquery;
window.$ = jquery;
}
register_global_libraries();