@nx/webpack 0.0.0-pr-26816-51699f9 → 0.0.0-pr-22870-dcac42e
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 +4 -5
- package/src/plugins/webpack-nx-build-coordination-plugin.js +8 -1
- package/src/utils/module-federation/models/index.d.ts +0 -7
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.d.ts +0 -3
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.js +0 -52
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-22870-dcac42e",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@babel/core": "^7.23.2",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"@module-federation/sdk": "^0.2.3",
|
|
36
|
-
"@module-federation/enhanced": "^0.2.3",
|
|
37
36
|
"ajv": "^8.12.0",
|
|
38
37
|
"autoprefixer": "^10.4.9",
|
|
39
38
|
"babel-loader": "^9.1.2",
|
|
@@ -67,9 +66,9 @@
|
|
|
67
66
|
"webpack-dev-server": "^4.9.3",
|
|
68
67
|
"webpack-node-externals": "^3.0.0",
|
|
69
68
|
"webpack-subresource-integrity": "^5.1.0",
|
|
70
|
-
"@nx/devkit": "0.0.0-pr-
|
|
71
|
-
"@nx/js": "0.0.0-pr-
|
|
72
|
-
"@nrwl/webpack": "0.0.0-pr-
|
|
69
|
+
"@nx/devkit": "0.0.0-pr-22870-dcac42e",
|
|
70
|
+
"@nx/js": "0.0.0-pr-22870-dcac42e",
|
|
71
|
+
"@nrwl/webpack": "0.0.0-pr-22870-dcac42e"
|
|
73
72
|
},
|
|
74
73
|
"publishConfig": {
|
|
75
74
|
"access": "public"
|
|
@@ -13,7 +13,14 @@ class WebpackNxBuildCoordinationPlugin {
|
|
|
13
13
|
if (!skipInitialBuild) {
|
|
14
14
|
this.buildChangedProjects();
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
if ((0, client_1.isDaemonEnabled)()) {
|
|
17
|
+
this.startWatchingBuildableLibs();
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
output_1.output.warn({
|
|
21
|
+
title: 'Nx Daemon is not enabled. Buildable libs will not be rebuilt on file changes.',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
apply(compiler) {
|
|
19
26
|
compiler.hooks.beforeCompile.tapPromise('IncrementalDevServerPlugin', async () => {
|
|
@@ -33,13 +33,6 @@ export interface ModuleFederationConfig {
|
|
|
33
33
|
exposes?: Record<string, string>;
|
|
34
34
|
shared?: SharedFunction;
|
|
35
35
|
additionalShared?: AdditionalSharedConfig;
|
|
36
|
-
/**
|
|
37
|
-
* NxLibraryControlPlugin is a runtime module federation plugin that
|
|
38
|
-
* ensures that shared packages are resolved from a remote with live reload
|
|
39
|
-
*
|
|
40
|
-
* Default: true
|
|
41
|
-
*/
|
|
42
|
-
useNxLibraryControlPlugin?: boolean;
|
|
43
36
|
}
|
|
44
37
|
export type NxModuleFederationConfigOverride = Omit<moduleFederationPlugin.ModuleFederationPluginOptions, 'exposes' | 'remotes' | 'name' | 'library' | 'shared' | 'filename' | 'remoteType'>;
|
|
45
38
|
export type WorkspaceLibrarySecondaryEntryPoint = {
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const runtimeStore = {
|
|
4
|
-
sharedPackagesFromDev: {},
|
|
5
|
-
};
|
|
6
|
-
if (process.env && process.env.NX_MF_DEV_REMOTES) {
|
|
7
|
-
runtimeStore.devRemotes = process.env.NX_MF_DEV_REMOTES;
|
|
8
|
-
}
|
|
9
|
-
const nxRuntimeLibraryControlPlugin = function () {
|
|
10
|
-
return {
|
|
11
|
-
name: 'nx-runtime-library-control-plugin',
|
|
12
|
-
beforeInit(args) {
|
|
13
|
-
runtimeStore.name = args.options.name;
|
|
14
|
-
return args;
|
|
15
|
-
},
|
|
16
|
-
resolveShare: (args) => {
|
|
17
|
-
const { shareScopeMap, scope, pkgName, version, GlobalFederation } = args;
|
|
18
|
-
const originalResolver = args.resolver;
|
|
19
|
-
args.resolver = function () {
|
|
20
|
-
if (!runtimeStore.sharedPackagesFromDev[pkgName]) {
|
|
21
|
-
if (!GlobalFederation.__INSTANCES__) {
|
|
22
|
-
return originalResolver();
|
|
23
|
-
}
|
|
24
|
-
else if (!runtimeStore.devRemotes) {
|
|
25
|
-
return originalResolver();
|
|
26
|
-
}
|
|
27
|
-
const devRemoteInstanceToUse = GlobalFederation.__INSTANCES__.find((instance) => instance.options.shared[pkgName] &&
|
|
28
|
-
runtimeStore.devRemotes.find((dr) => instance.name === dr));
|
|
29
|
-
if (!devRemoteInstanceToUse) {
|
|
30
|
-
return originalResolver();
|
|
31
|
-
}
|
|
32
|
-
runtimeStore.sharedPackagesFromDev[pkgName] =
|
|
33
|
-
devRemoteInstanceToUse.name;
|
|
34
|
-
}
|
|
35
|
-
const remoteInstanceName = runtimeStore.sharedPackagesFromDev[pkgName];
|
|
36
|
-
const remoteInstance = GlobalFederation.__INSTANCES__.find((instance) => instance.name === remoteInstanceName);
|
|
37
|
-
try {
|
|
38
|
-
const remotePkgInfo = remoteInstance.options.shared[pkgName].find((shared) => shared.from === remoteInstanceName);
|
|
39
|
-
remotePkgInfo.useIn.push(runtimeStore.name);
|
|
40
|
-
remotePkgInfo.useIn = Array.from(new Set(remotePkgInfo.useIn));
|
|
41
|
-
shareScopeMap[scope][pkgName][version] = remotePkgInfo;
|
|
42
|
-
return remotePkgInfo;
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return originalResolver();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return args;
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
exports.default = nxRuntimeLibraryControlPlugin;
|