@nx/angular 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/migrations.json +2 -2
- package/ng-package.json +1 -2
- package/package.json +8 -9
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +0 -2
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -2
- package/src/generators/utils/add-mf-env-to-inputs.js +1 -1
- package/src/utils/mf/with-module-federation-ssr.js +38 -55
- package/src/utils/mf/with-module-federation.js +41 -58
package/migrations.json
CHANGED
package/ng-package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
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 Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -78,16 +78,15 @@
|
|
|
78
78
|
"semver": "^7.5.3",
|
|
79
79
|
"tslib": "^2.3.0",
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
|
81
|
-
"webpack": "^5.88.0",
|
|
82
81
|
"@module-federation/enhanced": "~0.2.3",
|
|
83
|
-
"@nx/devkit": "0.0.0-pr-
|
|
84
|
-
"@nx/js": "0.0.0-pr-
|
|
85
|
-
"@nx/eslint": "0.0.0-pr-
|
|
86
|
-
"@nx/webpack": "0.0.0-pr-
|
|
87
|
-
"@nx/web": "0.0.0-pr-
|
|
88
|
-
"@nx/workspace": "0.0.0-pr-
|
|
82
|
+
"@nx/devkit": "0.0.0-pr-22870-dcac42e",
|
|
83
|
+
"@nx/js": "0.0.0-pr-22870-dcac42e",
|
|
84
|
+
"@nx/eslint": "0.0.0-pr-22870-dcac42e",
|
|
85
|
+
"@nx/webpack": "0.0.0-pr-22870-dcac42e",
|
|
86
|
+
"@nx/web": "0.0.0-pr-22870-dcac42e",
|
|
87
|
+
"@nx/workspace": "0.0.0-pr-22870-dcac42e",
|
|
89
88
|
"piscina": "^4.4.0",
|
|
90
|
-
"@nrwl/angular": "0.0.0-pr-
|
|
89
|
+
"@nrwl/angular": "0.0.0-pr-22870-dcac42e"
|
|
91
90
|
},
|
|
92
91
|
"peerDependencies": {
|
|
93
92
|
"@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
|
|
@@ -36,8 +36,6 @@ function executeModuleFederationDevSSRBuilder(schema, context) {
|
|
|
36
36
|
: Array.isArray(options.devRemotes)
|
|
37
37
|
? options.devRemotes
|
|
38
38
|
: [options.devRemotes];
|
|
39
|
-
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
40
|
-
process.env.NX_MF_DEV_REMOTES = JSON.stringify(devServeRemotes);
|
|
41
39
|
(0, module_federation_1.validateDevRemotes)({ devRemotes: devServeRemotes }, workspaceProjects);
|
|
42
40
|
const remotesToSkip = new Set(options.skipRemotes ?? []);
|
|
43
41
|
const staticRemotes = (0, module_federation_1.getStaticRemotes)(project, context, workspaceProjects, remotesToSkip);
|
|
@@ -62,8 +62,6 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
62
62
|
projectGraph: context.projectGraph,
|
|
63
63
|
root: context.root,
|
|
64
64
|
}, pathToManifestFile);
|
|
65
|
-
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
66
|
-
process.env.NX_MF_DEV_REMOTES = JSON.stringify(remotes.devRemotes.map((r) => (typeof r === 'string' ? r : r.remoteName)));
|
|
67
65
|
if (remotes.devRemotes.length > 0 && !schema.staticRemotesPort) {
|
|
68
66
|
options.staticRemotesPort = options.devRemotes.reduce((portToUse, r) => {
|
|
69
67
|
const remoteName = typeof r === 'string' ? r : r.remoteName;
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
function addMfEnvToTargetDefaultInputs(tree) {
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
7
|
const webpackExecutor = '@nx/angular:webpack-browser';
|
|
8
|
-
const mfEnvVar = '
|
|
8
|
+
const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
|
|
9
9
|
nxJson.targetDefaults ??= {};
|
|
10
10
|
nxJson.targetDefaults[webpackExecutor] ??= {};
|
|
11
11
|
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|
|
@@ -6,65 +6,48 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
6
6
|
if (global.NX_GRAPH_CREATION) {
|
|
7
7
|
return (config) => config;
|
|
8
8
|
}
|
|
9
|
-
options.useNxLibraryControlPlugin ??= true;
|
|
10
9
|
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options, {
|
|
11
10
|
isServer: true,
|
|
12
11
|
});
|
|
13
|
-
return (config) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
output
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
return (config) => ({
|
|
13
|
+
...(config ?? {}),
|
|
14
|
+
target: false,
|
|
15
|
+
output: {
|
|
16
|
+
...(config.output ?? {}),
|
|
17
|
+
uniqueName: options.name,
|
|
18
|
+
},
|
|
19
|
+
optimization: {
|
|
20
|
+
...(config.optimization ?? {}),
|
|
21
|
+
runtimeChunk: false,
|
|
22
|
+
},
|
|
23
|
+
resolve: {
|
|
24
|
+
...(config.resolve ?? {}),
|
|
25
|
+
alias: {
|
|
26
|
+
...(config.resolve?.alias ?? {}),
|
|
27
|
+
...sharedLibraries.getAliases(),
|
|
20
28
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
},
|
|
30
|
+
plugins: [
|
|
31
|
+
...(config.plugins ?? []),
|
|
32
|
+
new (require('@module-federation/node').UniversalFederationPlugin)({
|
|
33
|
+
name: options.name,
|
|
34
|
+
filename: 'remoteEntry.js',
|
|
35
|
+
exposes: options.exposes,
|
|
36
|
+
remotes: mappedRemotes,
|
|
37
|
+
shared: {
|
|
38
|
+
...sharedDependencies,
|
|
30
39
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
type: 'commonjs-module',
|
|
44
|
-
},
|
|
45
|
-
isServer: true,
|
|
46
|
-
/**
|
|
47
|
-
* Apply user-defined config override
|
|
48
|
-
*/
|
|
49
|
-
...(configOverride ? configOverride : {}),
|
|
50
|
-
runtimePlugins: process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin
|
|
51
|
-
? [
|
|
52
|
-
...(configOverride?.runtimePlugins ?? []),
|
|
53
|
-
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
|
54
|
-
]
|
|
55
|
-
: configOverride?.runtimePlugins,
|
|
56
|
-
}, {}),
|
|
57
|
-
sharedLibraries.getReplacementPlugin(),
|
|
58
|
-
],
|
|
59
|
-
};
|
|
60
|
-
if (process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin) {
|
|
61
|
-
// The env var is only set from the module-federation-dev-server
|
|
62
|
-
// Attach the runtime plugin
|
|
63
|
-
updatedConfig.plugins.push(new (require('webpack').DefinePlugin)({
|
|
64
|
-
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
return updatedConfig;
|
|
68
|
-
};
|
|
40
|
+
library: {
|
|
41
|
+
type: 'commonjs-module',
|
|
42
|
+
},
|
|
43
|
+
isServer: true,
|
|
44
|
+
/**
|
|
45
|
+
* Apply user-defined config override
|
|
46
|
+
*/
|
|
47
|
+
...(configOverride ? configOverride : {}),
|
|
48
|
+
}, {}),
|
|
49
|
+
sharedLibraries.getReplacementPlugin(),
|
|
50
|
+
],
|
|
51
|
+
});
|
|
69
52
|
}
|
|
70
53
|
exports.withModuleFederationForSSR = withModuleFederationForSSR;
|
|
@@ -7,66 +7,49 @@ async function withModuleFederation(options, configOverride) {
|
|
|
7
7
|
if (global.NX_GRAPH_CREATION) {
|
|
8
8
|
return (config) => config;
|
|
9
9
|
}
|
|
10
|
-
options.useNxLibraryControlPlugin ??= true;
|
|
11
10
|
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options);
|
|
12
|
-
return (config) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
output
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
return (config) => ({
|
|
12
|
+
...(config ?? {}),
|
|
13
|
+
output: {
|
|
14
|
+
...(config.output ?? {}),
|
|
15
|
+
uniqueName: options.name,
|
|
16
|
+
publicPath: 'auto',
|
|
17
|
+
},
|
|
18
|
+
optimization: {
|
|
19
|
+
...(config.optimization ?? {}),
|
|
20
|
+
runtimeChunk: false,
|
|
21
|
+
},
|
|
22
|
+
resolve: {
|
|
23
|
+
...(config.resolve ?? {}),
|
|
24
|
+
alias: {
|
|
25
|
+
...(config.resolve?.alias ?? {}),
|
|
26
|
+
...sharedLibraries.getAliases(),
|
|
19
27
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
},
|
|
29
|
+
experiments: {
|
|
30
|
+
...(config.experiments ?? {}),
|
|
31
|
+
outputModule: true,
|
|
32
|
+
},
|
|
33
|
+
plugins: [
|
|
34
|
+
...(config.plugins ?? []),
|
|
35
|
+
new webpack_1.ModuleFederationPlugin({
|
|
36
|
+
name: options.name,
|
|
37
|
+
filename: 'remoteEntry.mjs',
|
|
38
|
+
exposes: options.exposes,
|
|
39
|
+
remotes: mappedRemotes,
|
|
40
|
+
shared: {
|
|
41
|
+
...sharedDependencies,
|
|
29
42
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
...(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
remotes: mappedRemotes,
|
|
42
|
-
shared: {
|
|
43
|
-
...sharedDependencies,
|
|
44
|
-
},
|
|
45
|
-
library: {
|
|
46
|
-
type: 'module',
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* Apply user-defined config override
|
|
50
|
-
*/
|
|
51
|
-
...(configOverride ? configOverride : {}),
|
|
52
|
-
runtimePlugins: process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin
|
|
53
|
-
? [
|
|
54
|
-
...(configOverride?.runtimePlugins ?? []),
|
|
55
|
-
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
|
56
|
-
]
|
|
57
|
-
: configOverride?.runtimePlugins,
|
|
58
|
-
}),
|
|
59
|
-
sharedLibraries.getReplacementPlugin(),
|
|
60
|
-
],
|
|
61
|
-
};
|
|
62
|
-
if (process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin) {
|
|
63
|
-
// The env var is only set from the module-federation-dev-server
|
|
64
|
-
// Attach the runtime plugin
|
|
65
|
-
updatedConfig.plugins.push(new (require('webpack').DefinePlugin)({
|
|
66
|
-
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
return updatedConfig;
|
|
70
|
-
};
|
|
43
|
+
library: {
|
|
44
|
+
type: 'module',
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Apply user-defined config override
|
|
48
|
+
*/
|
|
49
|
+
...(configOverride ? configOverride : {}),
|
|
50
|
+
}),
|
|
51
|
+
sharedLibraries.getReplacementPlugin(),
|
|
52
|
+
],
|
|
53
|
+
});
|
|
71
54
|
}
|
|
72
55
|
exports.withModuleFederation = withModuleFederation;
|