@nx/angular 19.4.0 → 19.5.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/migrations.json CHANGED
@@ -1933,6 +1933,15 @@
1933
1933
  "alwaysAddToPackageJson": false
1934
1934
  }
1935
1935
  }
1936
+ },
1937
+ "19.5.0-module-federation": {
1938
+ "version": "19.5.0-beta.0",
1939
+ "packages": {
1940
+ "@module-federation/node": {
1941
+ "version": "^2.3.0",
1942
+ "alwaysAddToPackageJson": false
1943
+ }
1944
+ }
1936
1945
  }
1937
1946
  }
1938
1947
  }
package/ng-package.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "@nx/",
10
10
  "@angular-devkit",
11
11
  "@angular-eslint/",
12
+ "@module-federation/enhanced",
12
13
  "@schematics",
13
14
  "@phenomnomnominal/tsquery",
14
15
  "@typescript-eslint/",
@@ -20,7 +21,6 @@
20
21
  "ts-node",
21
22
  "tsconfig-paths",
22
23
  "semver",
23
- "webpack",
24
24
  "http-server",
25
25
  "magic-string",
26
26
  "enquirer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "19.4.0",
3
+ "version": "19.5.0-beta.0",
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": {
@@ -77,16 +77,16 @@
77
77
  "minimatch": "9.0.3",
78
78
  "semver": "^7.5.3",
79
79
  "tslib": "^2.3.0",
80
- "webpack": "^5.80.0",
81
80
  "webpack-merge": "^5.8.0",
82
- "@nx/devkit": "19.4.0",
83
- "@nx/js": "19.4.0",
84
- "@nx/eslint": "19.4.0",
85
- "@nx/webpack": "19.4.0",
86
- "@nx/web": "19.4.0",
87
- "@nx/workspace": "19.4.0",
81
+ "@module-federation/enhanced": "~0.2.3",
82
+ "@nx/devkit": "19.5.0-beta.0",
83
+ "@nx/js": "19.5.0-beta.0",
84
+ "@nx/eslint": "19.5.0-beta.0",
85
+ "@nx/webpack": "19.5.0-beta.0",
86
+ "@nx/web": "19.5.0-beta.0",
87
+ "@nx/workspace": "19.5.0-beta.0",
88
88
  "piscina": "^4.4.0",
89
- "@nrwl/angular": "19.4.0"
89
+ "@nrwl/angular": "19.5.0-beta.0"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
@@ -26,6 +26,12 @@ async function updateSsrSetup(tree, options, appName, typescriptConfiguration) {
26
26
  project.targets.server.options.customWebpackConfig = {
27
27
  path: (0, devkit_1.joinPathFragments)(project.root, `webpack.server.config.${pathToTemplateFiles}`),
28
28
  };
29
+ if (project.targets.server.configurations &&
30
+ project.targets.server.configurations.development) {
31
+ if ('vendorChunk' in project.targets.server.configurations.development) {
32
+ delete project.targets.server.configurations.development.vendorChunk;
33
+ }
34
+ }
29
35
  project.targets['serve-ssr'].executor =
30
36
  '@nx/angular:module-federation-dev-ssr';
31
37
  (0, devkit_1.updateProjectConfiguration)(tree, appName, project);
@@ -36,6 +36,12 @@ async function updateSsrSetup(tree, { appName, port, standalone, typescriptConfi
36
36
  project.targets.server.options.customWebpackConfig = {
37
37
  path: (0, devkit_1.joinPathFragments)(project.root, `webpack.server.config.${typescriptConfiguration ? 'ts' : 'js'}`),
38
38
  };
39
+ if (project.targets.server.configurations &&
40
+ project.targets.server.configurations.development) {
41
+ if ('vendorChunk' in project.targets.server.configurations.development) {
42
+ delete project.targets.server.configurations.development.vendorChunk;
43
+ }
44
+ }
39
45
  project.targets['serve-ssr'].options = {
40
46
  ...(project.targets['serve-ssr'].options ?? {}),
41
47
  port,
@@ -19,7 +19,11 @@ async function setupMf(tree, rawOptions) {
19
19
  (0, lib_1.removeDeadCodeFromRemote)(tree, options);
20
20
  (0, lib_1.setupTspathForRemote)(tree, options);
21
21
  if (!options.skipPackageJson) {
22
- installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion, '@nx/webpack': versions_1.nxVersion });
22
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
23
+ '@nx/web': versions_1.nxVersion,
24
+ '@nx/webpack': versions_1.nxVersion,
25
+ '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
26
+ });
23
27
  }
24
28
  }
25
29
  const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
@@ -39,7 +43,10 @@ async function setupMf(tree, rawOptions) {
39
43
  });
40
44
  }
41
45
  if (!options.skipPackageJson) {
42
- installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/webpack': versions_1.nxVersion });
46
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
47
+ '@nx/webpack': versions_1.nxVersion,
48
+ '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
49
+ });
43
50
  }
44
51
  }
45
52
  (0, lib_1.fixBootstrap)(tree, projectConfig.root, options);
@@ -17,7 +17,8 @@ exports.backwardCompatibleVersions = {
17
17
  expressVersion: '~4.18.2',
18
18
  typesExpressVersion: '4.17.14',
19
19
  browserSyncVersion: '^3.0.0',
20
- moduleFederationNodeVersion: '~1.0.5',
20
+ moduleFederationNodeVersion: '~2.3.0',
21
+ moduleFederationEnhancedVersion: '~0.2.3',
21
22
  angularEslintVersion: '~16.0.0',
22
23
  tailwindVersion: '^3.0.2',
23
24
  postcssVersion: '^8.4.5',
@@ -43,7 +44,8 @@ exports.backwardCompatibleVersions = {
43
44
  expressVersion: '~4.18.2',
44
45
  typesExpressVersion: '4.17.14',
45
46
  browserSyncVersion: '^3.0.0',
46
- moduleFederationNodeVersion: '~1.0.5',
47
+ moduleFederationNodeVersion: '~2.3.0',
48
+ moduleFederationEnhancedVersion: '~0.2.3',
47
49
  angularEslintVersion: '~17.3.0',
48
50
  tailwindVersion: '^3.0.2',
49
51
  postcssVersion: '^8.4.5',
@@ -1,2 +1,2 @@
1
- import { ModuleFederationConfig } from '@nx/webpack/src/utils/module-federation';
2
- export declare function withModuleFederationForSSR(options: ModuleFederationConfig): Promise<(config: any) => any>;
1
+ import type { ModuleFederationConfig, NxModuleFederationConfigOverride } from '@nx/webpack/src/utils/module-federation';
2
+ export declare function withModuleFederationForSSR(options: ModuleFederationConfig, configOverride?: NxModuleFederationConfigOverride): Promise<(config: any) => any>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withModuleFederationForSSR = void 0;
4
4
  const utils_1 = require("./utils");
5
- async function withModuleFederationForSSR(options) {
5
+ async function withModuleFederationForSSR(options, configOverride) {
6
6
  if (global.NX_GRAPH_CREATION) {
7
7
  return (config) => config;
8
8
  }
@@ -41,6 +41,10 @@ async function withModuleFederationForSSR(options) {
41
41
  type: 'commonjs-module',
42
42
  },
43
43
  isServer: true,
44
+ /**
45
+ * Apply user-defined config override
46
+ */
47
+ ...(configOverride ? configOverride : {}),
44
48
  }, {}),
45
49
  sharedLibraries.getReplacementPlugin(),
46
50
  ],
@@ -1,2 +1,2 @@
1
- import { ModuleFederationConfig } from '@nx/webpack/src/utils/module-federation';
2
- export declare function withModuleFederation(options: ModuleFederationConfig): Promise<(config: any) => any>;
1
+ import type { ModuleFederationConfig, NxModuleFederationConfigOverride } from '@nx/webpack/src/utils/module-federation';
2
+ export declare function withModuleFederation(options: ModuleFederationConfig, configOverride?: NxModuleFederationConfigOverride): Promise<(config: any) => any>;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withModuleFederation = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const utils_1 = require("./utils");
6
- const ModuleFederationPlugin_1 = tslib_1.__importDefault(require("webpack/lib/container/ModuleFederationPlugin"));
7
- async function withModuleFederation(options) {
5
+ const webpack_1 = require("@module-federation/enhanced/webpack");
6
+ async function withModuleFederation(options, configOverride) {
8
7
  if (global.NX_GRAPH_CREATION) {
9
8
  return (config) => config;
10
9
  }
@@ -33,7 +32,7 @@ async function withModuleFederation(options) {
33
32
  },
34
33
  plugins: [
35
34
  ...(config.plugins ?? []),
36
- new ModuleFederationPlugin_1.default({
35
+ new webpack_1.ModuleFederationPlugin({
37
36
  name: options.name,
38
37
  filename: 'remoteEntry.mjs',
39
38
  exposes: options.exposes,
@@ -44,6 +43,10 @@ async function withModuleFederation(options) {
44
43
  library: {
45
44
  type: 'module',
46
45
  },
46
+ /**
47
+ * Apply user-defined config override
48
+ */
49
+ ...(configOverride ? configOverride : {}),
47
50
  }),
48
51
  sharedLibraries.getReplacementPlugin(),
49
52
  ],
@@ -12,7 +12,8 @@ export declare const typesCorsVersion = "~2.8.5";
12
12
  export declare const expressVersion = "~4.18.2";
13
13
  export declare const typesExpressVersion = "4.17.14";
14
14
  export declare const browserSyncVersion = "^3.0.0";
15
- export declare const moduleFederationNodeVersion = "~1.0.5";
15
+ export declare const moduleFederationNodeVersion = "^2.3.0";
16
+ export declare const moduleFederationEnhancedVersion = "~0.2.3";
16
17
  export declare const angularEslintVersion = "^18.0.1";
17
18
  export declare const typescriptEslintVersion = "^8.0.0-alpha.28";
18
19
  export declare const tailwindVersion = "^3.0.2";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
3
+ exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
5
  exports.angularVersion = '~18.0.0';
6
6
  exports.angularDevkitVersion = '~18.0.0';
@@ -15,7 +15,8 @@ exports.typesCorsVersion = '~2.8.5';
15
15
  exports.expressVersion = '~4.18.2';
16
16
  exports.typesExpressVersion = '4.17.14';
17
17
  exports.browserSyncVersion = '^3.0.0';
18
- exports.moduleFederationNodeVersion = '~1.0.5';
18
+ exports.moduleFederationNodeVersion = '^2.3.0';
19
+ exports.moduleFederationEnhancedVersion = '~0.2.3';
19
20
  exports.angularEslintVersion = '^18.0.1';
20
21
  exports.typescriptEslintVersion = '^8.0.0-alpha.28';
21
22
  exports.tailwindVersion = '^3.0.2';