File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,11 @@ export class RspackCLI {
172
172
if ( typeof item . devtool === "undefined" ) {
173
173
item . devtool = isBuild ? "source-map" : "cheap-module-source-map" ;
174
174
}
175
+ // user parameters always has highest priority than default devtool and config devtool
176
+ if ( typeof options . devtool !== "undefined" ) {
177
+ item . devtool = options . devtool as RspackOptions [ "devtool" ] ;
178
+ }
179
+
175
180
if ( isServe ) {
176
181
const installed = ( item . plugins ||= [ ] ) . find (
177
182
item => item instanceof rspackCore . ProgressPlugin
Original file line number Diff line number Diff line change @@ -58,10 +58,15 @@ export const commonOptionsForBuildAndServe = (yargs: yargs.Argv) => {
58
58
describe : "env passed to config function"
59
59
} ,
60
60
devtool : {
61
- type : "boolean " ,
62
- default : false ,
61
+ type : "string " ,
62
+ default : "eval" ,
63
63
describe : "devtool" ,
64
- alias : "d"
64
+ alias : "d" ,
65
+ coerce : arg => {
66
+ if ( arg === "true" ) return "eval" ; // --devtool true 等价于 "eval"
67
+ if ( arg === "false" ) return false ; // --devtool false 表示禁用
68
+ return arg ;
69
+ }
65
70
}
66
71
} )
67
72
. alias ( { v : "version" , h : "help" } ) ;
You can’t perform that action at this time.
0 commit comments