dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

Microsoft.VisualStudio.JavaScript.SDK fails to generate package.g.props and then to do npm run build #42741

Open beppemarazzi opened 4 weeks ago

beppemarazzi commented 4 weeks ago

I don't know if this is the right place to report issues about Microsoft.VisualStudio.JavaScript.SDK... but i couldn't find any better place...

If package.json contains "similar" npm dependencies (similar in the sense that striping out non alphanumeric chars from their names, the remaining parts are equal) the task GeneratePackageJsonProps invoked from target GeneratePackageJsonProps silently fails. Raising the build logging (i.e. to verbose) appears an error (the task is trying to add duplicated keys in a dictionary). In this case the file package.g.props is not gegerated and then there are a lot of issues (i.e. npm run build is not executed...)

Example of "conflicting" dependecies (don't ask me why but yes, i need both in my project!!!):

"dependencies": {
  "@babylonjs/inspector": "^7.19.0",
  "babylonjs-inspector": "^7.19.0",

in this case both names @babylonjs/inspector and babylonjs-inspector are "mangled" by the task GeneratePackageJsonProps and becomes babylonjsinspector causing the issue...

i found a workaround using an npm alias:

"dependencies": {
  "@babylonjs/inspector": "^7.19.0",
  "standalone-babylonjs-inspector": "npm:babylonjs-inspector@^7.19.0",
baronfel commented 4 weeks ago

Thanks for reporting! Tagging in @joj for this one.