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
Added source File name for emitAsset func #14603
Conversation
Signed-off-by: Gurkiran Singh <gurkiransinghk@gmail.com>
For maintainers only:
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
lib/Compilation.js
Outdated
@@ -4086,7 +4086,7 @@ This prevents using hashes of each other and should be avoided.`); | |||
if (!isSourceEqual(this.assets[file], source)) { | |||
this.errors.push( | |||
new WebpackError( | |||
`Conflict: Multiple assets emit different content to the same filename ${file}` | |||
`Conflict: Multiple assets emit different content to the same filename ${file}. Source File: ${source}` |
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.
source
is the content of the file.
You could include assetInfo
in the message instead, this might give hints.
Signed-off-by: Gurkiran Singh <gurkiransinghk@gmail.com>
lib/Compilation.js
Outdated
@@ -4086,7 +4086,7 @@ This prevents using hashes of each other and should be avoided.`); | |||
if (!isSourceEqual(this.assets[file], source)) { | |||
this.errors.push( | |||
new WebpackError( | |||
`Conflict: Multiple assets emit different content to the same filename ${file}` | |||
`Conflict: Multiple assets emit different content to the same filename ${file}. Source File: ${assetInfo}` |
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.
You can't print an object that way, you might want to JSON.stringify
it, or print it in a nicer way.
Anyway, please also make sure to test the code. e. g. here is a test case you can update: test/configCases/emit-asset/different-source
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.
My apologies.
For testing, I have run the yarn jest ConfigTestCases
and from my understanding the testing has been done in ConfigTestCases.tempate.js
file which grabs the files from configCases
folder and tests them. But still didn't understand what should I update in test/configCases/emit-asset/different-source
? Please, let me know about it.
Signed-off-by: Gurkiran Singh <gurkiransinghk@gmail.com>
/cc @snitin315 Can you resend this and add a test case, thank you |
Fixed by #15888 |
Signed-off-by: Gurkiran Singh gurkiransinghk@gmail.com
What kind of change does this PR introduce?
Added the source File Info for emitAsset func .
Resolves #13695
Since, this is my first pr to webpack, I wasn't sure how to test this after making the changes. If someone can please let me know, that be really helpful.
Did you add tests for your changes?
No
Does this PR introduce a breaking change?
No
What needs to be documented once your changes are merged?
Nothing