@nx/webpack 17.2.0-rc.2 → 17.2.1

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 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.0-rc.2",
3
+ "version": "17.2.1",
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.0-rc.2",
66
- "@nx/js": "17.2.0-rc.2",
67
- "@nrwl/webpack": "17.2.0-rc.2"
65
+ "@nx/devkit": "17.2.1",
66
+ "@nx/js": "17.2.1",
67
+ "@nrwl/webpack": "17.2.1"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"
@@ -28,7 +28,9 @@ async function getWebpackConfigs(options, context) {
28
28
  }
29
29
  const config = options.isolatedConfig
30
30
  ? {}
31
- : (0, config_1.composePlugins)((0, with_nx_1.withNx)(options), (0, with_web_1.withWeb)(options));
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 });
32
34
  if ((0, config_1.isNxWebpackComposablePlugin)(userDefinedWebpackConfig)) {
33
35
  // Old behavior, call the Nx-specific webpack config function that user exports
34
36
  return await userDefinedWebpackConfig(config, {
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,29 @@
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
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/webpack:webpack', (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
+ await (0, devkit_1.formatFiles)(tree);
28
+ }
29
+ exports.default = default_1;