@nx/webpack 24.0.0-beta.1 → 24.0.0-beta.3
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/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/internal.d.ts +3 -0
- package/dist/internal.js +7 -1
- package/dist/src/executors/dev-server/dev-server.impl.js +38 -30
- package/dist/src/generators/configuration/configuration.js +14 -132
- package/dist/src/generators/configuration/schema.d.ts +0 -1
- package/dist/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js +82 -49
- package/dist/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts +1 -0
- package/dist/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.js +31 -2
- package/dist/src/generators/convert-config-to-webpack-plugin/schema.json +2 -2
- package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +5 -4
- package/dist/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +13 -5
- package/dist/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +8 -14
- package/dist/src/generators/init/init.js +45 -54
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +11 -0
- package/dist/src/migrations/update-24-0-0/inventory.d.ts +9 -0
- package/dist/src/migrations/update-24-0-0/inventory.js +53 -0
- package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.d.ts +10 -0
- package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.js +60 -0
- package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.md +98 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +36 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +92 -0
- package/dist/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +6 -0
- package/dist/src/plugins/nx-webpack-plugin/lib/normalize-options.js +29 -24
- package/dist/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +12 -1
- package/dist/src/utils/config.d.ts +8 -12
- package/dist/src/utils/config.js +15 -68
- package/dist/src/utils/deprecation.d.ts +1 -6
- package/dist/src/utils/deprecation.js +4 -27
- package/dist/src/utils/e2e-web-server-info-utils.d.ts +1 -1
- package/dist/src/utils/e2e-web-server-info-utils.js +2 -2
- package/dist/src/utils/with-nx.d.ts +5 -9
- package/dist/src/utils/with-nx.js +5 -32
- package/dist/src/utils/with-web.d.ts +5 -9
- package/dist/src/utils/with-web.js +5 -24
- package/executors.json +0 -10
- package/migrations.json +13 -0
- package/package.json +4 -4
- package/dist/src/executors/webpack/lib/run-webpack.d.ts +0 -3
- package/dist/src/executors/webpack/lib/run-webpack.js +0 -36
- package/dist/src/executors/webpack/schema.json +0 -459
- package/dist/src/executors/webpack/webpack.impl.d.ts +0 -13
- package/dist/src/executors/webpack/webpack.impl.js +0 -117
- package/dist/src/utils/has-plugin.d.ts +0 -2
- package/dist/src/utils/has-plugin.js +0 -10
|
@@ -29,13 +29,24 @@ class NxAppWebpackPlugin {
|
|
|
29
29
|
if (typeof target === 'string') {
|
|
30
30
|
this.options.target = target;
|
|
31
31
|
}
|
|
32
|
+
// Cypress supplies its own `main` entry and index.html, and license
|
|
33
|
+
// extraction fails with ENOENT for buildable libraries under component
|
|
34
|
+
// testing.
|
|
35
|
+
if (process.env.NX_CYPRESS_COMPONENT_TEST === 'true') {
|
|
36
|
+
this.options.main = undefined;
|
|
37
|
+
this.options.generateIndexHtml = false;
|
|
38
|
+
this.options.extractLicenses = false;
|
|
39
|
+
}
|
|
32
40
|
applyBaseConfig(this.options, compiler.options, {
|
|
33
41
|
useNormalizedEntry: true,
|
|
34
42
|
});
|
|
43
|
+
compiler.context = compiler.options.context;
|
|
35
44
|
if (compiler.options.target) {
|
|
36
45
|
this.options.target = compiler.options.target;
|
|
37
46
|
}
|
|
38
|
-
if (this.options.target === 'web' ||
|
|
47
|
+
if (this.options.target === 'web' ||
|
|
48
|
+
this.options.target === 'webworker' ||
|
|
49
|
+
this.options.ssr) {
|
|
39
50
|
applyWebConfig(this.options, compiler.options, {
|
|
40
51
|
useNormalizedEntry: true,
|
|
41
52
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
1
|
+
import type { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import type { Configuration } from 'webpack';
|
|
3
|
-
import { NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
|
|
3
|
+
import type { NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
|
|
4
4
|
export declare const nxWebpackComposablePlugin = "nxWebpackComposablePlugin";
|
|
5
5
|
export declare function isNxWebpackComposablePlugin(a: unknown): a is AsyncNxComposableWebpackPlugin;
|
|
6
6
|
export interface NxWebpackExecutionContext {
|
|
@@ -15,20 +15,16 @@ export interface AsyncNxComposableWebpackPlugin {
|
|
|
15
15
|
(config: Configuration, ctx: NxWebpackExecutionContext): Configuration | Promise<Configuration>;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
*
|
|
20
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
21
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
18
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
19
|
+
* This inert stub will be removed in Nx v25.
|
|
22
20
|
*/
|
|
23
|
-
export declare function composePlugins(...
|
|
21
|
+
export declare function composePlugins(..._plugins: (NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin | Promise<NxComposableWebpackPlugin | AsyncNxComposableWebpackPlugin>)[]): ((config?: Configuration, ctx?: NxWebpackExecutionContext) => Promise<Configuration>) & {
|
|
24
22
|
nxWebpackComposablePlugin: boolean;
|
|
25
23
|
};
|
|
26
24
|
/**
|
|
27
|
-
* @deprecated
|
|
28
|
-
*
|
|
29
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
30
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
25
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
26
|
+
* This inert stub will be removed in Nx v25.
|
|
31
27
|
*/
|
|
32
|
-
export declare function composePluginsSync(...
|
|
28
|
+
export declare function composePluginsSync(..._plugins: NxComposableWebpackPlugin[]): ((config?: Configuration, ctx?: NxWebpackExecutionContext) => Configuration) & {
|
|
33
29
|
nxWebpackComposablePlugin: boolean;
|
|
34
30
|
};
|
package/dist/src/utils/config.js
CHANGED
|
@@ -4,84 +4,31 @@ exports.nxWebpackComposablePlugin = void 0;
|
|
|
4
4
|
exports.isNxWebpackComposablePlugin = isNxWebpackComposablePlugin;
|
|
5
5
|
exports.composePlugins = composePlugins;
|
|
6
6
|
exports.composePluginsSync = composePluginsSync;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const internal_1 = require("@nx/js/internal");
|
|
9
7
|
const deprecation_1 = require("./deprecation");
|
|
10
|
-
const internal_2 = require("@nx/devkit/internal");
|
|
11
8
|
exports.nxWebpackComposablePlugin = 'nxWebpackComposablePlugin';
|
|
12
9
|
function isNxWebpackComposablePlugin(a) {
|
|
13
10
|
return a?.[exports.nxWebpackComposablePlugin] === true;
|
|
14
11
|
}
|
|
12
|
+
// TODO(v25): remove the inert config-helper stubs in this file.
|
|
15
13
|
/**
|
|
16
|
-
* @deprecated
|
|
17
|
-
*
|
|
18
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
19
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
14
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
15
|
+
* This inert stub will be removed in Nx v25.
|
|
20
16
|
*/
|
|
21
|
-
function composePlugins(...
|
|
17
|
+
function composePlugins(..._plugins) {
|
|
22
18
|
(0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
|
|
23
|
-
return Object.assign(async
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (ctx['env']) {
|
|
28
|
-
ensureNxWebpackExecutionContext(ctx);
|
|
29
|
-
// Build this from scratch since what webpack passes us is the env, not config,
|
|
30
|
-
// and `withNX()` creates a new config object anyway.
|
|
31
|
-
config = {};
|
|
32
|
-
}
|
|
33
|
-
for (const plugin of plugins) {
|
|
34
|
-
const fn = await plugin;
|
|
35
|
-
config = await fn(config, ctx);
|
|
36
|
-
}
|
|
37
|
-
return config;
|
|
38
|
-
}, {
|
|
39
|
-
[exports.nxWebpackComposablePlugin]: true,
|
|
40
|
-
});
|
|
19
|
+
return Object.assign(async (config = {}, ctx) => {
|
|
20
|
+
// Only the legacy Nx executor passes a config; CLIs pass (env, argv).
|
|
21
|
+
return ctx?.context && typeof ctx.context === 'object' ? config : {};
|
|
22
|
+
}, { [exports.nxWebpackComposablePlugin]: true });
|
|
41
23
|
}
|
|
42
24
|
/**
|
|
43
|
-
* @deprecated
|
|
44
|
-
*
|
|
45
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
46
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
25
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
26
|
+
* This inert stub will be removed in Nx v25.
|
|
47
27
|
*/
|
|
48
|
-
function composePluginsSync(...
|
|
28
|
+
function composePluginsSync(..._plugins) {
|
|
49
29
|
(0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
|
|
50
|
-
return Object.assign(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return config;
|
|
55
|
-
}, {
|
|
56
|
-
[exports.nxWebpackComposablePlugin]: true,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function ensureNxWebpackExecutionContext(ctx) {
|
|
60
|
-
const projectName = process.env.NX_TASK_TARGET_PROJECT;
|
|
61
|
-
const targetName = process.env.NX_TASK_TARGET_TARGET;
|
|
62
|
-
const configurationName = process.env.NX_TASK_TARGET_CONFIGURATION;
|
|
63
|
-
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
64
|
-
const projectNode = projectGraph.nodes[projectName];
|
|
65
|
-
ctx.options ??= {
|
|
66
|
-
root: devkit_1.workspaceRoot,
|
|
67
|
-
projectRoot: projectNode.data.root,
|
|
68
|
-
sourceRoot: (0, internal_1.getProjectSourceRoot)(projectNode.data),
|
|
69
|
-
// These aren't actually needed since NxWebpackPlugin and withNx both support them being undefined.
|
|
70
|
-
assets: undefined,
|
|
71
|
-
outputPath: undefined,
|
|
72
|
-
tsConfig: undefined,
|
|
73
|
-
outputFileName: undefined,
|
|
74
|
-
useTsconfigPaths: undefined,
|
|
75
|
-
};
|
|
76
|
-
ctx.context ??= {
|
|
77
|
-
projectName,
|
|
78
|
-
targetName,
|
|
79
|
-
configurationName,
|
|
80
|
-
projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
|
|
81
|
-
nxJsonConfiguration: (0, internal_2.readNxJsonFromDisk)(devkit_1.workspaceRoot),
|
|
82
|
-
cwd: process.cwd(),
|
|
83
|
-
root: devkit_1.workspaceRoot,
|
|
84
|
-
isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
|
|
85
|
-
projectGraph,
|
|
86
|
-
};
|
|
30
|
+
return Object.assign((config = {}, ctx) => {
|
|
31
|
+
// Only the legacy Nx executor passes a config; CLIs pass (env, argv).
|
|
32
|
+
return ctx?.context && typeof ctx.context === 'object' ? config : {};
|
|
33
|
+
}, { [exports.nxWebpackComposablePlugin]: true });
|
|
87
34
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/webpack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
|
-
export declare function warnWebpackExecutorDeprecation(): void;
|
|
4
|
-
export declare function warnWebpackDevServerExecutorDeprecation(): void;
|
|
5
|
-
export declare function warnWebpackExecutorGenerating(): void;
|
|
6
|
-
export declare const WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The `composePlugins`, `withNx`, and `withWeb` config helpers from `@nx/webpack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/webpack:webpack` executor. Migrate to a standard webpack config that uses `NxAppWebpackPlugin` (from `@nx/webpack/app-plugin`) under the inferred `@nx/webpack/plugin` by running `nx g @nx/webpack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
1
|
+
export declare const WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = "The compose config helpers from `@nx/webpack` were removed in Nx v24. The remaining exports are inert compatibility stubs and do not configure builds. Migrate to a standard webpack config using `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`. Follow the config-helper migration instructions generated by `nx migrate`. Executor conversion is a separate migration.";
|
|
7
2
|
export declare function suppressWebpackComposeHelperWarnings<T>(fn: () => T): T;
|
|
8
3
|
export declare function warnWebpackComposeHelpersDeprecation(): void;
|
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE =
|
|
4
|
-
exports.warnWebpackExecutorDeprecation = warnWebpackExecutorDeprecation;
|
|
5
|
-
exports.warnWebpackDevServerExecutorDeprecation = warnWebpackDevServerExecutorDeprecation;
|
|
6
|
-
exports.warnWebpackExecutorGenerating = warnWebpackExecutorGenerating;
|
|
3
|
+
exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = void 0;
|
|
7
4
|
exports.suppressWebpackComposeHelperWarnings = suppressWebpackComposeHelperWarnings;
|
|
8
5
|
exports.warnWebpackComposeHelpersDeprecation = warnWebpackComposeHelpersDeprecation;
|
|
9
6
|
const devkit_1 = require("@nx/devkit");
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/webpack:webpack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
14
|
-
exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/webpack:dev-server` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
15
|
-
function warnWebpackExecutorDeprecation() {
|
|
16
|
-
devkit_1.logger.warn(exports.WEBPACK_EXECUTOR_DEPRECATION_MESSAGE);
|
|
17
|
-
}
|
|
18
|
-
function warnWebpackDevServerExecutorDeprecation() {
|
|
19
|
-
devkit_1.logger.warn(exports.WEBPACK_DEV_SERVER_EXECUTOR_DEPRECATION_MESSAGE);
|
|
20
|
-
}
|
|
21
|
-
// Fired when the @nx/webpack:configuration generator is about to generate
|
|
22
|
-
// targets that use the deprecated executors — i.e. when @nx/webpack/plugin
|
|
23
|
-
// isn't registered in nx.json. Surfaces the deprecation at generation time
|
|
24
|
-
// rather than only when the user later runs the generated targets.
|
|
25
|
-
function warnWebpackExecutorGenerating() {
|
|
26
|
-
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/webpack:webpack` and `@nx/webpack:dev-server` executors. These executors will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` next to migrate these targets to the `@nx/webpack/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
27
|
-
}
|
|
28
|
-
// TODO(v24): Remove the composePlugins/withNx/withWeb config helpers. They emit
|
|
29
|
-
// an Nx-specific config function that only runs under the @nx/webpack:webpack
|
|
30
|
-
// executor; the inferred @nx/webpack/plugin works with standard webpack configs
|
|
31
|
-
// built around NxAppWebpackPlugin instead.
|
|
32
|
-
exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The `composePlugins`, `withNx`, and `withWeb` config helpers from `@nx/webpack` are deprecated and will be removed in Nx v24. They produce an Nx-specific config function that only runs under the `@nx/webpack:webpack` executor. Migrate to a standard webpack config that uses `NxAppWebpackPlugin` (from `@nx/webpack/app-plugin`) under the inferred `@nx/webpack/plugin` by running `nx g @nx/webpack:convert-to-inferred`. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
7
|
+
// Helper behavior was removed in v24; exports remain only as inert stubs.
|
|
8
|
+
// Keep their exports loadable so old configs do not block graph creation.
|
|
9
|
+
exports.WEBPACK_COMPOSE_HELPERS_DEPRECATION_MESSAGE = 'The compose config helpers from `@nx/webpack` were removed in Nx v24. The remaining exports are inert compatibility stubs and do not configure builds. Migrate to a standard webpack config using `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`. Follow the config-helper migration instructions generated by `nx migrate`. Executor conversion is a separate migration.';
|
|
33
10
|
let composeHelpersWarned = false;
|
|
34
11
|
let suppressDepth = 0;
|
|
35
12
|
// Nx-internal entry points compose these helpers themselves (e.g. the rspack
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
export declare function getWebpackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string,
|
|
2
|
+
export declare function getWebpackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, e2ePortOverride?: number): Promise<import("@nx/devkit/internal").E2EWebServerDetails>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getWebpackE2EWebServerInfo = getWebpackE2EWebServerInfo;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
async function getWebpackE2EWebServerInfo(tree, projectName, configFilePath,
|
|
6
|
+
async function getWebpackE2EWebServerInfo(tree, projectName, configFilePath, e2ePortOverride) {
|
|
7
7
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
8
8
|
let e2ePort = e2ePortOverride ?? 4200;
|
|
9
9
|
const servePort = (0, internal_1.readTargetDefaultsForTarget)('serve', nxJson.targetDefaults)
|
|
@@ -26,5 +26,5 @@ async function getWebpackE2EWebServerInfo(tree, projectName, configFilePath, isP
|
|
|
26
26
|
defaultE2ECiBaseUrl: `http://localhost:${e2ePort}`,
|
|
27
27
|
defaultE2EPort: e2ePort,
|
|
28
28
|
e2EPortIsExplicit: e2ePortOverride != null,
|
|
29
|
-
}
|
|
29
|
+
});
|
|
30
30
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { NxComposableWebpackPlugin } from './config';
|
|
2
|
-
import { NxAppWebpackPluginOptions } from '../plugins/nx-webpack-plugin/nx-app-webpack-plugin-options';
|
|
1
|
+
import type { NxComposableWebpackPlugin } from './config';
|
|
2
|
+
import type { NxAppWebpackPluginOptions } from '../plugins/nx-webpack-plugin/nx-app-webpack-plugin-options';
|
|
3
3
|
export type WithNxOptions = Partial<NxAppWebpackPluginOptions>;
|
|
4
4
|
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
*
|
|
7
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
8
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
9
|
-
* @param {WithNxOptions} pluginOptions
|
|
10
|
-
* @returns {NxWebpackPlugin}
|
|
5
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
6
|
+
* This inert stub will be removed in Nx v25.
|
|
11
7
|
*/
|
|
12
|
-
export declare function withNx(
|
|
8
|
+
export declare function withNx(_options?: WithNxOptions): NxComposableWebpackPlugin;
|
|
@@ -1,40 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withNx = withNx;
|
|
4
|
-
const normalize_options_1 = require("../plugins/nx-webpack-plugin/lib/normalize-options");
|
|
5
4
|
const deprecation_1 = require("./deprecation");
|
|
6
|
-
|
|
5
|
+
// TODO(v25): remove the inert config-helper stubs in this file.
|
|
7
6
|
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
*
|
|
10
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
11
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
12
|
-
* @param {WithNxOptions} pluginOptions
|
|
13
|
-
* @returns {NxWebpackPlugin}
|
|
7
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
8
|
+
* This inert stub will be removed in Nx v25.
|
|
14
9
|
*/
|
|
15
|
-
function withNx(
|
|
10
|
+
function withNx(_options = {}) {
|
|
16
11
|
(0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
|
|
17
|
-
return
|
|
18
|
-
if (processed.has(config))
|
|
19
|
-
return config;
|
|
20
|
-
// Lazy-required so importing this module does not load the webpack bundler.
|
|
21
|
-
const { applyBaseConfig } = require('../plugins/nx-webpack-plugin/lib/apply-base-config');
|
|
22
|
-
applyBaseConfig({
|
|
23
|
-
...options,
|
|
24
|
-
...pluginOptions,
|
|
25
|
-
target: options.target ?? 'web',
|
|
26
|
-
assets: options.assets
|
|
27
|
-
? options.assets
|
|
28
|
-
: pluginOptions.assets
|
|
29
|
-
? (0, normalize_options_1.normalizeAssets)(pluginOptions.assets, options.root, options.sourceRoot, options.projectRoot)
|
|
30
|
-
: [],
|
|
31
|
-
root: context.root,
|
|
32
|
-
projectName: context.projectName,
|
|
33
|
-
targetName: context.targetName,
|
|
34
|
-
configurationName: context.configurationName,
|
|
35
|
-
projectGraph: context.projectGraph,
|
|
36
|
-
}, config);
|
|
37
|
-
processed.add(config);
|
|
38
|
-
return config;
|
|
39
|
-
};
|
|
12
|
+
return (config) => config;
|
|
40
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NxComposableWebpackPlugin } from './config';
|
|
2
|
-
import { ExtraEntryPointClass, NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
|
|
1
|
+
import type { NxComposableWebpackPlugin } from './config';
|
|
2
|
+
import type { ExtraEntryPointClass, NormalizedWebpackExecutorOptions } from '../executors/webpack/schema';
|
|
3
3
|
export interface WithWebOptions {
|
|
4
4
|
baseHref?: string;
|
|
5
5
|
crossOrigin?: 'none' | 'anonymous' | 'use-credentials';
|
|
@@ -20,11 +20,7 @@ export interface WithWebOptions {
|
|
|
20
20
|
}
|
|
21
21
|
export type MergedOptions = Omit<NormalizedWebpackExecutorOptions, keyof WithWebOptions> & WithWebOptions;
|
|
22
22
|
/**
|
|
23
|
-
* @deprecated
|
|
24
|
-
*
|
|
25
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
26
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
27
|
-
* @param {WithWebOptions} pluginOptions
|
|
28
|
-
* @returns {NxWebpackPlugin}
|
|
23
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
24
|
+
* This inert stub will be removed in Nx v25.
|
|
29
25
|
*/
|
|
30
|
-
export declare function withWeb(
|
|
26
|
+
export declare function withWeb(_options?: WithWebOptions): NxComposableWebpackPlugin;
|
|
@@ -2,31 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withWeb = withWeb;
|
|
4
4
|
const deprecation_1 = require("./deprecation");
|
|
5
|
-
|
|
5
|
+
// TODO(v25): remove the inert config-helper stubs in this file.
|
|
6
6
|
/**
|
|
7
|
-
* @deprecated
|
|
8
|
-
*
|
|
9
|
-
* `nx g @nx/webpack:convert-to-inferred`. See
|
|
10
|
-
* https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.
|
|
11
|
-
* @param {WithWebOptions} pluginOptions
|
|
12
|
-
* @returns {NxWebpackPlugin}
|
|
7
|
+
* @deprecated Use `NxAppWebpackPlugin` from `@nx/webpack/app-plugin`.
|
|
8
|
+
* This inert stub will be removed in Nx v25.
|
|
13
9
|
*/
|
|
14
|
-
function withWeb(
|
|
10
|
+
function withWeb(_options = {}) {
|
|
15
11
|
(0, deprecation_1.warnWebpackComposeHelpersDeprecation)();
|
|
16
|
-
return
|
|
17
|
-
if (processed.has(config))
|
|
18
|
-
return config;
|
|
19
|
-
// Lazy-required so importing this module does not load the webpack bundler.
|
|
20
|
-
const { applyWebConfig } = require('../plugins/nx-webpack-plugin/lib/apply-web-config');
|
|
21
|
-
applyWebConfig({
|
|
22
|
-
...options,
|
|
23
|
-
...pluginOptions,
|
|
24
|
-
projectName: context.projectName,
|
|
25
|
-
targetName: context.targetName,
|
|
26
|
-
configurationName: context.configurationName,
|
|
27
|
-
projectGraph: context.projectGraph,
|
|
28
|
-
}, config);
|
|
29
|
-
processed.add(config);
|
|
30
|
-
return config;
|
|
31
|
-
};
|
|
12
|
+
return (config) => config;
|
|
32
13
|
}
|
package/executors.json
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"executors": {
|
|
3
|
-
"webpack": {
|
|
4
|
-
"implementation": "./dist/src/executors/webpack/webpack.impl",
|
|
5
|
-
"schema": "./dist/src/executors/webpack/schema.json",
|
|
6
|
-
"description": "Run webpack build."
|
|
7
|
-
},
|
|
8
|
-
"dev-server": {
|
|
9
|
-
"implementation": "./dist/src/executors/dev-server/dev-server.impl",
|
|
10
|
-
"schema": "./dist/src/executors/dev-server/schema.json",
|
|
11
|
-
"description": "Serve a web application."
|
|
12
|
-
},
|
|
13
3
|
"ssr-dev-server": {
|
|
14
4
|
"implementation": "./dist/src/executors/ssr-dev-server/ssr-dev-server.impl",
|
|
15
5
|
"schema": "./dist/src/executors/ssr-dev-server/schema.json",
|
package/migrations.json
CHANGED
|
@@ -30,6 +30,19 @@
|
|
|
30
30
|
"description": "Rename imports of `createNodesV2` from `@nx/webpack/plugin` to the canonical `createNodes` export.",
|
|
31
31
|
"implementation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes",
|
|
32
32
|
"documentation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md"
|
|
33
|
+
},
|
|
34
|
+
"remove-deprecated-executors": {
|
|
35
|
+
"version": "24.0.0-beta.3",
|
|
36
|
+
"description": "Converts targets using the removed `@nx/webpack` executors to inferred tasks; an AI prompt finishes the targets the converter cannot convert safely and validates the project graph.",
|
|
37
|
+
"implementation": "./dist/src/migrations/update-24-0-0/remove-deprecated-executors",
|
|
38
|
+
"prompt": "./dist/src/migrations/update-24-0-0/finish-inferred-conversion.md",
|
|
39
|
+
"documentation": "./dist/src/migrations/update-24-0-0/remove-deprecated-executors.md"
|
|
40
|
+
},
|
|
41
|
+
"update-24-0-0-migrate-compose-plugins": {
|
|
42
|
+
"version": "24.0.0-beta.3",
|
|
43
|
+
"description": "Converts webpack configs that use the removed `composePlugins`, `withNx`, `withWeb` and `withReact` helpers with `@nx/webpack:convert-config-to-webpack-plugin`, then hands an AI prompt the projects it could not convert and the `.old` configs it left behind.",
|
|
44
|
+
"implementation": "./dist/src/migrations/update-24-0-0/migrate-compose-plugins",
|
|
45
|
+
"prompt": "./dist/src/migrations/update-24-0-0/migrate-compose-plugins.md"
|
|
33
46
|
}
|
|
34
47
|
},
|
|
35
48
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "24.0.0-beta.
|
|
3
|
+
"version": "24.0.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
"tslib": "^2.3.0",
|
|
119
119
|
"webpack-node-externals": "^3.0.0",
|
|
120
120
|
"webpack-subresource-integrity": "^5.1.0",
|
|
121
|
-
"@nx/devkit": "24.0.0-beta.
|
|
122
|
-
"@nx/js": "24.0.0-beta.
|
|
121
|
+
"@nx/devkit": "24.0.0-beta.3",
|
|
122
|
+
"@nx/js": "24.0.0-beta.3"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"webpack": "^5.0.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
|
-
"nx": "24.0.0-beta.
|
|
141
|
+
"nx": "24.0.0-beta.3"
|
|
142
142
|
},
|
|
143
143
|
"publishConfig": {
|
|
144
144
|
"access": "public"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runWebpack = runWebpack;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
// TODO(jack): move to dev-server executor
|
|
6
|
-
function runWebpack(config) {
|
|
7
|
-
// Lazy-loaded: `webpack` is an optional peer, absent during project-graph discovery.
|
|
8
|
-
const webpackImpl = require('webpack');
|
|
9
|
-
return new rxjs_1.Observable((subscriber) => {
|
|
10
|
-
// Passing `watch` option here will result in a warning due to missing callback.
|
|
11
|
-
// We manually call `.watch` or `.run` later so this option isn't needed here.
|
|
12
|
-
const { watch, ...normalizedConfig } = config;
|
|
13
|
-
const webpackCompiler = webpackImpl(normalizedConfig);
|
|
14
|
-
const callback = (err, stats) => {
|
|
15
|
-
if (err) {
|
|
16
|
-
subscriber.error(err);
|
|
17
|
-
}
|
|
18
|
-
subscriber.next(stats);
|
|
19
|
-
};
|
|
20
|
-
if (config.watch) {
|
|
21
|
-
const watchOptions = config.watchOptions || {};
|
|
22
|
-
const watching = webpackCompiler.watch(watchOptions, callback);
|
|
23
|
-
return () => watching.close(() => subscriber.complete());
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
webpackCompiler.run((err, stats) => {
|
|
27
|
-
callback(err, stats);
|
|
28
|
-
webpackCompiler.close((closeErr) => {
|
|
29
|
-
if (closeErr)
|
|
30
|
-
subscriber.error(closeErr);
|
|
31
|
-
subscriber.complete();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|