diff --git a/packages/rspack/src/executors/rspack/schema.d.ts b/packages/rspack/src/executors/rspack/schema.d.ts index dfbff63a98e48..10dcd8c545123 100644 --- a/packages/rspack/src/executors/rspack/schema.d.ts +++ b/packages/rspack/src/executors/rspack/schema.d.ts @@ -1,4 +1,4 @@ -import type { Mode } from '@rspack/core'; +import type { DevTool, Mode } from '@rspack/core'; export interface RspackExecutorSchema { additionalEntryPoints?: AdditionalEntryPoint[]; @@ -32,7 +32,7 @@ export interface RspackExecutorSchema { runtimeChunk?: boolean; scripts?: Array; skipTypeChecking?: boolean; - sourceMap?: boolean | string; + sourceMap?: boolean | DevTool; standardRspackConfigFunction?: boolean; statsJson?: boolean; stylePreprocessorOptions?: any; diff --git a/packages/rspack/src/plugins/utils/apply-base-config.ts b/packages/rspack/src/plugins/utils/apply-base-config.ts index 6e309ccc7b41c..33139b417c78f 100644 --- a/packages/rspack/src/plugins/utils/apply-base-config.ts +++ b/packages/rspack/src/plugins/utils/apply-base-config.ts @@ -8,6 +8,7 @@ import { SwcJsMinimizerRspackPlugin, CopyRspackPlugin, RspackOptionsNormalized, + type DevTool, } from '@rspack/core'; import { getRootTsConfigPath } from '@nx/js'; @@ -87,11 +88,7 @@ function applyNxIndependentConfig( config.cache = options.target === 'node' && options.watch ? true : undefined; config.devtool = - options.sourceMap === 'hidden' - ? 'hidden-source-map' - : options.sourceMap - ? 'source-map' - : false; + options.sourceMap === true ? 'source-map' : options.sourceMap; config.output = { ...(config.output ?? {}), diff --git a/packages/rspack/src/plugins/utils/models.ts b/packages/rspack/src/plugins/utils/models.ts index 925da59b047e7..82455ce8fdbea 100644 --- a/packages/rspack/src/plugins/utils/models.ts +++ b/packages/rspack/src/plugins/utils/models.ts @@ -1,4 +1,4 @@ -import type { Mode } from '@rspack/core'; +import type { DevTool, Mode } from '@rspack/core'; import type { ProjectGraph } from '@nx/devkit'; import type { AssetGlob } from '@nx/js/src/utils/assets/assets'; @@ -182,7 +182,7 @@ export interface NxAppRspackPluginOptions { /** * Generate source maps. */ - sourceMap?: boolean | string; + sourceMap?: boolean | DevTool; /** * When `true`, `process.env.NODE_ENV` will be excluded from the bundle. Useful for building a web application to run in a Node environment. */ diff --git a/packages/webpack/src/executors/webpack/schema.d.ts b/packages/webpack/src/executors/webpack/schema.d.ts index 610e76f5c544e..883e4d91ca9d5 100644 --- a/packages/webpack/src/executors/webpack/schema.d.ts +++ b/packages/webpack/src/executors/webpack/schema.d.ts @@ -62,7 +62,7 @@ export interface WebpackExecutorOptions { polyfills?: string; progress?: boolean; runtimeChunk?: boolean; - sourceMap?: boolean | 'hidden'; + sourceMap?: boolean | string; statsJson?: boolean; target?: string; transformers?: TransformerEntry[]; diff --git a/packages/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.ts b/packages/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.ts index 1f84310786085..751435ecdad29 100644 --- a/packages/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.ts +++ b/packages/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.ts @@ -86,11 +86,7 @@ function applyNxIndependentConfig( options.target === 'node' && options.watch ? { type: 'memory' } : undefined; config.devtool = - options.sourceMap === 'hidden' - ? 'hidden-source-map' - : options.sourceMap - ? 'source-map' - : false; + options.sourceMap === true ? 'source-map' : options.sourceMap; config.output = { ...config.output, diff --git a/packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts b/packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts index 2adde5f110ff0..fac494d3ff5c6 100644 --- a/packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts +++ b/packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts @@ -182,7 +182,7 @@ export interface NxAppWebpackPluginOptions { /** * Generate source maps. */ - sourceMap?: boolean | 'hidden'; + sourceMap?: boolean | string; /** * When `true`, `process.env.NODE_ENV` will be excluded from the bundle. Useful for building a web application to run in a Node environment. */