-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat: consolidated sourceMap-related fields in devtool
#19485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
|
|
||
| F(options, "devtool", () => (development ? "eval" : false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We put it after making options.output default b/c we rely on output.uniqueName
42ee44e to
9908283
Compare
CodSpeed Performance ReportMerging #19485 will degrade performances by 10.48%Comparing Summary
Benchmarks breakdown
|
27ec59a to
2ed2eac
Compare
lib/WebpackOptionsApply.js
Outdated
| const cheap = devtool.type.includes("cheap"); | ||
| const moduleMaps = devtool.type.includes("module"); | ||
| const noSources = devtool.type.includes("nosources"); | ||
| const debugIds = devtool.type.includes("debugids"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we should do it in normalization.js, so in default.js we will already have object, but I am afraid it can be breaking change, because some developers can rely on output.devtool as a string.
There is a good question should we want to support devtool: string in future, if yes - code looks good, if no - we need to add TODO.
I'm actually in favor of supporting the string value in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually in favor of supporting the string value in the future.
Me too. I think it's not too bad to still supporting devtool: string. So user can easily setting when development and as far as I know, if need to generate production sourcemaps they usually use plugin.
| namespace: options.output.devtoolNamespace, | ||
| namespace, | ||
| debugIds | ||
| }).apply(compiler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we don't allow to provide columns/debugIds/etc values in the object notation or you want to finish it after this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, columns and debugIds depend on the devtool setting (i.e., devtool.includes("cheap") / "debugids").
Yeah, separating them into a dedicated field is a good idea - but should we still support specifying them via string literals or by devtool.type (e.g., cheap-xxx, debugids-xxx)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense only for an object notation, we already have string values which cover every option
172c0bf to
d98ffbf
Compare
…lability and improve DX
d98ffbf to
6012ee0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, can we add a couple simple test cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What kind of change does this PR introduce?
Follows #19389 (comment) Step 1.
Consolidated SourceMap-related fields under
devtoolto enhance scalability and improve developer experience (DX). Now, devtool can be defined using an object literal, like so:Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
What needs to be documented once your changes are merged?
object notation of
devtool