Skip to content

Commit

Permalink
fix(webpack): sourceMap type should accept all types of sourceMaps (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham authored Nov 15, 2024
1 parent 2d5acec commit 1b7cd9b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/rspack/src/executors/rspack/schema.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Mode } from '@rspack/core';
import type { DevTool, Mode } from '@rspack/core';

export interface RspackExecutorSchema {
additionalEntryPoints?: AdditionalEntryPoint[];
Expand Down Expand Up @@ -32,7 +32,7 @@ export interface RspackExecutorSchema {
runtimeChunk?: boolean;
scripts?: Array<ExtraEntryPointClass | string>;
skipTypeChecking?: boolean;
sourceMap?: boolean | string;
sourceMap?: boolean | DevTool;
standardRspackConfigFunction?: boolean;
statsJson?: boolean;
stylePreprocessorOptions?: any;
Expand Down
7 changes: 2 additions & 5 deletions packages/rspack/src/plugins/utils/apply-base-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SwcJsMinimizerRspackPlugin,
CopyRspackPlugin,
RspackOptionsNormalized,
type DevTool,
} from '@rspack/core';
import { getRootTsConfigPath } from '@nx/js';

Expand Down Expand Up @@ -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 ?? {}),
Expand Down
4 changes: 2 additions & 2 deletions packages/rspack/src/plugins/utils/models.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/src/executors/webpack/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 1b7cd9b

Please sign in to comment.