@nx/webpack 19.8.14 → 19.8.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "19.8.14",
3
+ "version": "19.8.15",
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": {
@@ -69,9 +69,9 @@
69
69
  "webpack-dev-server": "^5.0.4",
70
70
  "webpack-node-externals": "^3.0.0",
71
71
  "webpack-subresource-integrity": "^5.1.0",
72
- "@nx/devkit": "19.8.14",
73
- "@nx/js": "19.8.14",
74
- "@nrwl/webpack": "19.8.14"
72
+ "@nx/devkit": "19.8.15",
73
+ "@nx/js": "19.8.15",
74
+ "@nrwl/webpack": "19.8.15"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
@@ -4,5 +4,5 @@ export declare class NxTsconfigPathsWebpackPlugin {
4
4
  private options;
5
5
  constructor(options: NormalizedNxAppWebpackPluginOptions);
6
6
  apply(compiler: Compiler): void;
7
- handleBuildLibsFromSource(config: Partial<WebpackOptionsNormalized | Configuration>, options: any): void;
7
+ handleBuildLibsFromSource(config: Partial<WebpackOptionsNormalized | Configuration>, options: NormalizedNxAppWebpackPluginOptions): void;
8
8
  }
@@ -42,7 +42,9 @@ class NxTsconfigPathsWebpackPlugin {
42
42
  .map((dependency) => dependency.node.name)
43
43
  .join(',');
44
44
  const buildCommand = `nx run-many --target=build --projects=${buildableDependencies}`;
45
- config.plugins.push(new webpack_nx_build_coordination_plugin_1.WebpackNxBuildCoordinationPlugin(buildCommand));
45
+ config.plugins.push(new webpack_nx_build_coordination_plugin_1.WebpackNxBuildCoordinationPlugin(buildCommand, {
46
+ skipWatchingDeps: options.watchDependencies === false,
47
+ }));
46
48
  }
47
49
  }
48
50
  }
@@ -222,6 +222,10 @@ export interface NxAppWebpackPluginOptions {
222
222
  * Whether to rebase absolute path for assets in postcss cli resources.
223
223
  */
224
224
  rebaseRootRelative?: boolean;
225
+ /**
226
+ * Watch buildable dependencies and rebuild when they change.
227
+ */
228
+ watchDependencies?: boolean;
225
229
  }
226
230
  export interface NormalizedNxAppWebpackPluginOptions extends NxAppWebpackPluginOptions {
227
231
  projectName: string;
@@ -1,11 +1,21 @@
1
1
  import type { Compiler } from 'webpack';
2
+ type PluginOptions = {
3
+ skipInitialBuild?: boolean;
4
+ skipWatchingDeps?: boolean;
5
+ };
2
6
  export declare class WebpackNxBuildCoordinationPlugin {
3
7
  private readonly buildCmd;
4
8
  private currentlyRunning;
5
9
  private buildCmdProcess;
10
+ constructor(buildCmd: string);
11
+ /**
12
+ * @deprecated Use the constructor with the `options` parameter instead.
13
+ */
6
14
  constructor(buildCmd: string, skipInitialBuild?: boolean);
15
+ constructor(buildCmd: string, options?: PluginOptions);
7
16
  apply(compiler: Compiler): void;
8
17
  startWatchingBuildableLibs(): Promise<void>;
9
18
  buildChangedProjects(): Promise<void>;
10
19
  private createFileWatcher;
11
20
  }
21
+ export {};
@@ -6,20 +6,25 @@ const client_1 = require("nx/src/daemon/client/client");
6
6
  const watch_1 = require("nx/src/command-line/watch/watch");
7
7
  const output_1 = require("nx/src/utils/output");
8
8
  class WebpackNxBuildCoordinationPlugin {
9
- constructor(buildCmd, skipInitialBuild) {
9
+ constructor(buildCmd, skipInitialBuildOrOptions) {
10
10
  this.buildCmd = buildCmd;
11
11
  this.currentlyRunning = 'none';
12
12
  this.buildCmdProcess = null;
13
- if (!skipInitialBuild) {
13
+ const options = typeof skipInitialBuildOrOptions === 'boolean'
14
+ ? { skipInitialBuild: skipInitialBuildOrOptions }
15
+ : skipInitialBuildOrOptions;
16
+ if (!options?.skipInitialBuild) {
14
17
  this.buildChangedProjects();
15
18
  }
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
- });
19
+ if (!options?.skipWatchingDeps) {
20
+ if ((0, client_1.isDaemonEnabled)()) {
21
+ this.startWatchingBuildableLibs();
22
+ }
23
+ else {
24
+ output_1.output.warn({
25
+ title: 'Nx Daemon is not enabled. Buildable libs will not be rebuilt on file changes.',
26
+ });
27
+ }
23
28
  }
24
29
  }
25
30
  apply(compiler) {
@@ -49,7 +49,16 @@ function getRemotes(devRemotes, skipRemotes, config, context, pathToManifestFile
49
49
  devkit_1.logger.info(`Remotes not served automatically: ${[...remotesToSkip.values()].join(', ')}`);
50
50
  }
51
51
  const knownRemotes = Array.from(collectedRemotes).filter((r) => !remotesToSkip.has(r));
52
- const knownDynamicRemotes = dynamicRemotes.filter((r) => !remotesToSkip.has(r) && context.projectGraph.nodes[r]);
52
+ // With dynamic remotes, the manifest file may contain the names with `_` due to MF limitations on naming
53
+ // The project graph might contain these names with `-` rather than `_`. Check for both.
54
+ // This can occur after migration of existing remotes past Nx 19.8
55
+ let normalizedDynamicRemotes = dynamicRemotes.map((r) => {
56
+ if (context.projectGraph.nodes[r.replace(/_/g, '-')]) {
57
+ return r.replace(/_/g, '-');
58
+ }
59
+ return r;
60
+ });
61
+ const knownDynamicRemotes = normalizedDynamicRemotes.filter((r) => !remotesToSkip.has(r) && context.projectGraph.nodes[r]);
53
62
  devkit_1.logger.info(`NX Starting module federation dev-server for ${chalk.bold(context.projectName)} with ${[...knownRemotes, ...knownDynamicRemotes].length} remotes`);
54
63
  const devServeApps = new Set(!devRemotes
55
64
  ? []