@noego/app 0.0.19 → 0.0.20
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.
- package/package.json +1 -1
- package/src/container.js +5 -4
package/package.json
CHANGED
package/src/container.js
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* even if multiple versions of the package are loaded.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
9
|
+
|
|
8
10
|
const CONTAINER_KEY = Symbol.for('@noego/app.container');
|
|
9
11
|
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
+
// Create require function for ES module context
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Get the global IoC container instance.
|
|
@@ -18,8 +20,7 @@ let _createContainer = null;
|
|
|
18
20
|
*/
|
|
19
21
|
export function getContainer() {
|
|
20
22
|
if (!globalThis[CONTAINER_KEY]) {
|
|
21
|
-
// Dynamically require @noego/ioc to
|
|
22
|
-
// and to use the version from the user's project
|
|
23
|
+
// Dynamically require @noego/ioc to use the version from the user's project
|
|
23
24
|
const { createContainer } = require('@noego/ioc');
|
|
24
25
|
globalThis[CONTAINER_KEY] = createContainer();
|
|
25
26
|
}
|