@nx/webpack 17.2.0 → 17.2.2
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 +6 -0
- package/package.json +4 -4
- package/src/executors/dev-server/dev-server.impl.js +3 -1
- package/src/executors/webpack/schema.d.ts +1 -0
- package/src/executors/webpack/schema.json +5 -0
- package/src/executors/webpack/webpack.impl.js +6 -2
- package/src/migrations/update-17-2-1/webpack-config-setup.d.ts +2 -0
- package/src/migrations/update-17-2-1/webpack-config-setup.js +31 -0
package/migrations.json
CHANGED
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
"version": "16.0.0-beta.1",
|
|
30
30
|
"description": "Replace @nrwl/webpack with @nx/webpack",
|
|
31
31
|
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
32
|
+
},
|
|
33
|
+
"update-17-2-1-webpack-config-setup": {
|
|
34
|
+
"cli": "nx",
|
|
35
|
+
"version": "17.2.1-beta.0",
|
|
36
|
+
"description": "Add webpack.config.js file when webpackConfig is not defined",
|
|
37
|
+
"implementation": "./src/migrations/update-17-2-1/webpack-config-setup"
|
|
32
38
|
}
|
|
33
39
|
},
|
|
34
40
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.2",
|
|
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": {
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"webpack-dev-server": "^4.9.3",
|
|
63
63
|
"webpack-node-externals": "^3.0.0",
|
|
64
64
|
"webpack-subresource-integrity": "^5.1.0",
|
|
65
|
-
"@nx/devkit": "17.2.
|
|
66
|
-
"@nx/js": "17.2.
|
|
67
|
-
"@nrwl/webpack": "17.2.
|
|
65
|
+
"@nx/devkit": "17.2.2",
|
|
66
|
+
"@nx/js": "17.2.2",
|
|
67
|
+
"@nrwl/webpack": "17.2.2"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
@@ -36,7 +36,9 @@ async function* devServerExecutor(serveOptions, context) {
|
|
|
36
36
|
}
|
|
37
37
|
// Only add the dev server option if user is composable plugin.
|
|
38
38
|
// Otherwise, user should define `devServer` option directly in their webpack config.
|
|
39
|
-
if (
|
|
39
|
+
if (typeof userDefinedWebpackConfig === 'function' &&
|
|
40
|
+
(0, config_1.isNxWebpackComposablePlugin)(userDefinedWebpackConfig) &&
|
|
41
|
+
!buildOptions.standardWebpackConfigFunction) {
|
|
40
42
|
config = await userDefinedWebpackConfig({ devServer }, {
|
|
41
43
|
options: buildOptions,
|
|
42
44
|
context,
|
|
@@ -50,6 +50,7 @@ export interface WebpackExecutorOptions {
|
|
|
50
50
|
// TODO(v18): Remove this option
|
|
51
51
|
/** @deprecated set webpackConfig and provide an explicit webpack.config.js file (See: https://nx.dev/recipes/webpack/webpack-config-setup) */
|
|
52
52
|
isolatedConfig?: boolean;
|
|
53
|
+
standardWebpackConfigFunction?: boolean;
|
|
53
54
|
main?: string;
|
|
54
55
|
memoryLimit?: number;
|
|
55
56
|
namedChunks?: boolean;
|
|
@@ -237,6 +237,11 @@
|
|
|
237
237
|
"default": true,
|
|
238
238
|
"x-deprecated": "Automatic configuration of Webpack is deprecated in favor of an explicit 'webpack.config.js' file. This option will be removed in Nx 18. See https://nx.dev/recipes/webpack/webpack-config-setup."
|
|
239
239
|
},
|
|
240
|
+
"standardWebpackConfigFunction": {
|
|
241
|
+
"type": "boolean",
|
|
242
|
+
"description": "Set to true if the webpack config exports a standard webpack function, not an Nx-specific one. See: https://webpack.js.org/configuration/configuration-types/#exporting-a-function",
|
|
243
|
+
"default": false
|
|
244
|
+
},
|
|
240
245
|
"extractLicenses": {
|
|
241
246
|
"type": "boolean",
|
|
242
247
|
"description": "Extract all licenses in a separate file, in the case of production builds only."
|
|
@@ -28,8 +28,12 @@ async function getWebpackConfigs(options, context) {
|
|
|
28
28
|
}
|
|
29
29
|
const config = options.isolatedConfig
|
|
30
30
|
? {}
|
|
31
|
-
: (
|
|
32
|
-
|
|
31
|
+
: (options.target === 'web'
|
|
32
|
+
? (0, config_1.composePluginsSync)((0, with_nx_1.withNx)(options), (0, with_web_1.withWeb)(options))
|
|
33
|
+
: (0, with_nx_1.withNx)(options))({}, { options, context });
|
|
34
|
+
if (typeof userDefinedWebpackConfig === 'function' &&
|
|
35
|
+
(0, config_1.isNxWebpackComposablePlugin)(userDefinedWebpackConfig) &&
|
|
36
|
+
!options.standardWebpackConfigFunction) {
|
|
33
37
|
// Old behavior, call the Nx-specific webpack config function that user exports
|
|
34
38
|
return await userDefinedWebpackConfig(config, {
|
|
35
39
|
options,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
5
|
+
async function default_1(tree) {
|
|
6
|
+
const update = (options, projectName, targetName, configurationName) => {
|
|
7
|
+
// Only handle webpack config for default configuration
|
|
8
|
+
if (configurationName)
|
|
9
|
+
return;
|
|
10
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
11
|
+
if (!options.webpackConfig && options.isolatedConfig !== false) {
|
|
12
|
+
options.webpackConfig = `${projectConfiguration.root}/webpack.config.js`;
|
|
13
|
+
tree.write(options.webpackConfig, `
|
|
14
|
+
const { composePlugins, withNx } = require('@nx/webpack');
|
|
15
|
+
|
|
16
|
+
// Nx plugins for webpack.
|
|
17
|
+
module.exports = composePlugins(withNx(), (config) => {
|
|
18
|
+
// Note: This was added by an Nx migration. Webpack builds are required to have a corresponding Webpack config file.
|
|
19
|
+
// See: https://nx.dev/recipes/webpack/webpack-config-setup
|
|
20
|
+
return config;
|
|
21
|
+
});
|
|
22
|
+
`);
|
|
23
|
+
projectConfiguration.targets[targetName].options = options;
|
|
24
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/webpack:webpack', update);
|
|
28
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', update);
|
|
29
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
30
|
+
}
|
|
31
|
+
exports.default = default_1;
|