@nx/webpack 21.2.2 → 21.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "21.2.2",
3
+ "version": "21.2.3",
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": {
@@ -66,8 +66,8 @@
66
66
  "webpack-dev-server": "^5.2.1",
67
67
  "webpack-node-externals": "^3.0.0",
68
68
  "webpack-subresource-integrity": "^5.1.0",
69
- "@nx/devkit": "21.2.2",
70
- "@nx/js": "21.2.2"
69
+ "@nx/devkit": "21.2.3",
70
+ "@nx/js": "21.2.3"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"
@@ -3,15 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webpackExecutor = webpackExecutor;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
6
+ const js_1 = require("@nx/js");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
+ const path_1 = require("path");
6
9
  const rxjs_1 = require("rxjs");
7
10
  const operators_1 = require("rxjs/operators");
8
- const path_1 = require("path");
9
- const run_webpack_1 = require("./lib/run-webpack");
11
+ const config_1 = require("../../utils/config");
10
12
  const fs_1 = require("../../utils/fs");
11
13
  const resolve_user_defined_webpack_config_1 = require("../../utils/webpack/resolve-user-defined-webpack-config");
12
14
  const normalize_options_1 = require("./lib/normalize-options");
13
- const config_1 = require("../../utils/config");
14
- const js_1 = require("@nx/js");
15
+ const run_webpack_1 = require("./lib/run-webpack");
15
16
  async function getWebpackConfigs(options, context) {
16
17
  let userDefinedWebpackConfig = null;
17
18
  if (options.webpackConfig) {
@@ -49,7 +50,7 @@ async function* webpackExecutor(_options, context) {
49
50
  // Default to production build.
50
51
  process.env['NODE_ENV'] ||= 'production';
51
52
  const metadata = context.projectsConfigurations.projects[context.projectName];
52
- const sourceRoot = metadata.sourceRoot;
53
+ const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(metadata);
53
54
  const options = (0, normalize_options_1.normalizeOptions)(_options, context.root, metadata.root, sourceRoot);
54
55
  const isScriptOptimizeOn = typeof options.optimization === 'boolean'
55
56
  ? options.optimization
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = normalizeOptions;
4
4
  exports.normalizeAssets = normalizeAssets;
5
5
  exports.normalizeFileReplacements = normalizeFileReplacements;
6
- const path_1 = require("path");
7
- const fs_1 = require("fs");
8
6
  const devkit_1 = require("@nx/devkit");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
+ const fs_1 = require("fs");
9
+ const path_1 = require("path");
9
10
  function normalizeOptions(options) {
10
11
  const combinedPluginAndMaybeExecutorOptions = {};
11
12
  const isProd = process.env.NODE_ENV === 'production';
@@ -48,10 +49,7 @@ function normalizeOptions(options) {
48
49
  // executor options take precedence (especially for overriding with CLI args)
49
50
  originalTargetOptions);
50
51
  }
51
- const sourceRoot = projectNode.data.sourceRoot ??
52
- ((0, fs_1.existsSync)((0, path_1.join)(devkit_1.workspaceRoot, projectNode.data.root, 'src'))
53
- ? (0, path_1.join)(projectNode.data.root, 'src')
54
- : projectNode.data.root);
52
+ const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(projectNode.data);
55
53
  if (!combinedPluginAndMaybeExecutorOptions.main) {
56
54
  throw new Error(`Missing "main" option for the entry file. Set this option in your Nx webpack plugin.`);
57
55
  }
@@ -5,6 +5,7 @@ exports.isNxWebpackComposablePlugin = isNxWebpackComposablePlugin;
5
5
  exports.composePlugins = composePlugins;
6
6
  exports.composePluginsSync = composePluginsSync;
7
7
  const devkit_1 = require("@nx/devkit");
8
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
9
  const configuration_1 = require("nx/src/config/configuration");
9
10
  exports.nxWebpackComposablePlugin = 'nxWebpackComposablePlugin';
10
11
  function isNxWebpackComposablePlugin(a) {
@@ -49,7 +50,7 @@ function ensureNxWebpackExecutionContext(ctx) {
49
50
  ctx.options ??= {
50
51
  root: devkit_1.workspaceRoot,
51
52
  projectRoot: projectNode.data.root,
52
- sourceRoot: projectNode.data.sourceRoot ?? projectNode.data.root,
53
+ sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(projectNode.data),
53
54
  // These aren't actually needed since NxWebpackPlugin and withNx both support them being undefined.
54
55
  assets: undefined,
55
56
  outputPath: undefined,