@nx/webpack 20.2.2 → 20.3.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "20.2.2",
3
+ "version": "20.3.0-beta.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": {
@@ -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.2.2",
69
- "@nx/js": "20.2.2"
68
+ "@nx/devkit": "20.3.0-beta.1",
69
+ "@nx/js": "20.3.0-beta.1"
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public"
@@ -4,9 +4,11 @@ exports.normalizeOptions = normalizeOptions;
4
4
  exports.normalizePluginPath = normalizePluginPath;
5
5
  const path_1 = require("path");
6
6
  const normalize_options_1 = require("../../../plugins/nx-webpack-plugin/lib/normalize-options");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
8
  function normalizeOptions(options, root, projectRoot, sourceRoot) {
8
9
  const normalizedOptions = {
9
10
  ...options,
11
+ useTsconfigPaths: !(0, ts_solution_setup_1.isUsingTsSolutionSetup)(),
10
12
  root,
11
13
  projectRoot,
12
14
  sourceRoot,
@@ -95,4 +95,5 @@ export interface NormalizedWebpackExecutorOptions
95
95
  root: string;
96
96
  projectRoot: string;
97
97
  sourceRoot: string;
98
+ useTsconfigPaths: boolean;
98
99
  }
@@ -177,9 +177,14 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
177
177
  configurationName: options.configurationName,
178
178
  root: options.root,
179
179
  };
180
- plugins.push(new nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin({ ...options, tsConfig }));
180
+ const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
181
+ options.useTsconfigPaths ??= !isUsingTsSolution;
182
+ // If the project is using ts solutions setup, the paths are not in tsconfig and we should not use the plugin's paths.
183
+ if (options.useTsconfigPaths) {
184
+ plugins.push(new nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin({ ...options, tsConfig }));
185
+ }
181
186
  // New TS Solution already has a typecheck target
182
- if (!options?.skipTypeChecking && !(0, ts_solution_setup_1.isUsingTsSolutionSetup)()) {
187
+ if (!options?.skipTypeChecking && !isUsingTsSolution) {
183
188
  const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
184
189
  plugins.push(new ForkTsCheckerWebpackPlugin({
185
190
  typescript: {
@@ -202,6 +202,10 @@ export interface NxAppWebpackPluginOptions {
202
202
  * List of TypeScript Compiler Transformers Plugins.
203
203
  */
204
204
  transformers?: TransformerEntry[];
205
+ /**
206
+ * Use tsconfig-paths-webpack-plugin to resolve modules using paths in the tsconfig file.
207
+ */
208
+ useTsconfigPaths?: boolean;
205
209
  /**
206
210
  * Generate a separate vendor chunk for 3rd party packages.
207
211
  */
@@ -55,6 +55,7 @@ function ensureNxWebpackExecutionContext(ctx) {
55
55
  outputPath: undefined,
56
56
  tsConfig: undefined,
57
57
  outputFileName: undefined,
58
+ useTsconfigPaths: undefined,
58
59
  };
59
60
  ctx.context ??= {
60
61
  projectName,
@@ -25,6 +25,7 @@ async function readWebpackOptions(webpackConfig) {
25
25
  outputFileName: undefined,
26
26
  outputPath: undefined,
27
27
  assets: undefined,
28
+ useTsconfigPaths: undefined,
28
29
  },
29
30
  context: {
30
31
  root: devkit_1.workspaceRoot,