Skip to content

Commit

Permalink
fix(webpack): Add useTsconfigPaths to app-webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed Dec 10, 2024
1 parent 098d8a6 commit 6cf7294
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ function applyNxDependentConfig(
root: options.root,
};

plugins.push(new NxTsconfigPathsWebpackPlugin({ ...options, tsConfig }));
if (options.useTsconfigPaths) {
plugins.push(new NxTsconfigPathsWebpackPlugin({ ...options, tsConfig }));
}

// New TS Solution already has a typecheck target
if (!options?.skipTypeChecking && !isUsingTsSolutionSetup()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
NormalizedNxAppWebpackPluginOptions,
NxAppWebpackPluginOptions,
} from '../nx-app-webpack-plugin-options';
import { isUsingTsSolutionSetup } from '@nx/js/src/utils/typescript/ts-solution-setup';

export function normalizeOptions(
options: NxAppWebpackPluginOptions
Expand All @@ -37,6 +38,8 @@ export function normalizeOptions(

const projectNode = projectGraph.nodes[projectName];
const targetConfig = projectNode.data.targets[targetName];
options.useTsconfigPaths =
options.useTsconfigPaths ?? !isUsingTsSolutionSetup();

normalizeRelativePaths(projectNode.data.root, options);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ export interface NxAppWebpackPluginOptions {
* List of TypeScript Compiler Transformers Plugins.
*/
transformers?: TransformerEntry[];
/**
* Use tsconfig-paths-webpack-plugin to resolve modules using paths in the tsconfig file.
*/
useTsconfigPaths?: boolean;
/**
* Generate a separate vendor chunk for 3rd party packages.
*/
Expand Down

0 comments on commit 6cf7294

Please sign in to comment.