diff --git a/packages/webpack/src/utils/with-nx.ts b/packages/webpack/src/utils/with-nx.ts index 6b4f29b6a67b97..67c22e9e60f729 100644 --- a/packages/webpack/src/utils/with-nx.ts +++ b/packages/webpack/src/utils/with-nx.ts @@ -164,7 +164,7 @@ export function withNx(opts?: { skipTypeChecking?: boolean }) { profile: options.statsJson, resolve: { ...config.resolve, - extensions, + extensions: [...extensions, ...config.resolve.extensions], alias: options.fileReplacements.reduce( (aliases, replacement) => ({ ...aliases, @@ -175,7 +175,7 @@ export function withNx(opts?: { skipTypeChecking?: boolean }) { plugins: [ new TsconfigPathsPlugin({ configFile: options.tsConfig, - extensions, + extensions: [...extensions, ...config.resolve.extensions], mainFields, }), ], @@ -231,6 +231,7 @@ export function withNx(opts?: { skipTypeChecking?: boolean }) { // Enabled for performance unsafeCache: true, rules: [ + ...config.module.rules, options.sourceMap && { test: /\.js$/, enforce: 'pre' as const,