@nx/webpack 20.5.0-beta.2 → 20.5.0-beta.4
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 +3 -3
- package/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.d.ts +1 -1
- package/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js +3 -1
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +4 -0
- package/src/plugins/webpack-nx-build-coordination-plugin.d.ts +10 -0
- package/src/plugins/webpack-nx-build-coordination-plugin.js +15 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "20.5.0-beta.
|
|
3
|
+
"version": "20.5.0-beta.4",
|
|
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": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"webpack-dev-server": "^5.0.4",
|
|
66
66
|
"webpack-node-externals": "^3.0.0",
|
|
67
67
|
"webpack-subresource-integrity": "^5.1.0",
|
|
68
|
-
"@nx/devkit": "20.5.0-beta.
|
|
69
|
-
"@nx/js": "20.5.0-beta.
|
|
68
|
+
"@nx/devkit": "20.5.0-beta.4",
|
|
69
|
+
"@nx/js": "20.5.0-beta.4"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"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:
|
|
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
|
}
|
|
@@ -226,6 +226,10 @@ export interface NxAppWebpackPluginOptions {
|
|
|
226
226
|
* Whether to rebase absolute path for assets in postcss cli resources.
|
|
227
227
|
*/
|
|
228
228
|
rebaseRootRelative?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Watch buildable dependencies and rebuild when they change.
|
|
231
|
+
*/
|
|
232
|
+
watchDependencies?: boolean;
|
|
229
233
|
}
|
|
230
234
|
export interface NormalizedNxAppWebpackPluginOptions extends NxAppWebpackPluginOptions {
|
|
231
235
|
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 {};
|
|
@@ -5,21 +5,27 @@ const child_process_1 = require("child_process");
|
|
|
5
5
|
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
|
+
const enabled_1 = require("nx/src/daemon/client/enabled");
|
|
8
9
|
class WebpackNxBuildCoordinationPlugin {
|
|
9
|
-
constructor(buildCmd,
|
|
10
|
+
constructor(buildCmd, skipInitialBuildOrOptions) {
|
|
10
11
|
this.buildCmd = buildCmd;
|
|
11
12
|
this.currentlyRunning = 'none';
|
|
12
13
|
this.buildCmdProcess = null;
|
|
13
|
-
|
|
14
|
+
const options = typeof skipInitialBuildOrOptions === 'boolean'
|
|
15
|
+
? { skipInitialBuild: skipInitialBuildOrOptions }
|
|
16
|
+
: skipInitialBuildOrOptions;
|
|
17
|
+
if (!options?.skipInitialBuild) {
|
|
14
18
|
this.buildChangedProjects();
|
|
15
19
|
}
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (!options?.skipWatchingDeps) {
|
|
21
|
+
if ((0, enabled_1.isDaemonEnabled)()) {
|
|
22
|
+
this.startWatchingBuildableLibs();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
output_1.output.warn({
|
|
26
|
+
title: 'Nx Daemon is not enabled. Buildable libs will not be rebuilt on file changes.',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
apply(compiler) {
|