Skip to content
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

Shims not bundled if installed under npm alias for v3 #809

Closed
dfenerski opened this issue Mar 24, 2023 · 2 comments · Fixed by SAP/ui5-project#608
Closed

Shims not bundled if installed under npm alias for v3 #809

dfenerski opened this issue Mar 24, 2023 · 2 comments · Fixed by SAP/ui5-project#608
Assignees
Labels
bug Something isn't working module/ui5-project Related to the UI5 Project module

Comments

@dfenerski
Copy link

Expected Behavior

Automatic dependency analysis should be able to pick up exposed name of npm dependency, regardless of the underlying package.

Current Behavior

If one runs npm i kool@npm:case and then provides shim configuration for kool, the tooling won't pick it up.

Steps to Reproduce the Issue

  1. open npm sample app
  2. install a npm package under alias, reference
  3. provide a basic shimming config like this one
    image

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 3.0.5
  • Node.js Version: 16.19.1
  • npm Version: 8.19.3
  • OS/Platform: Win11
  • Browser (if relevant): not relevant
  • Other information regarding your environment (optional): nothing

Log Output / Stack Trace

I can provide additional log traces / info if needed.

@dfenerski dfenerski added bug Something isn't working needs triage Needs to be investigated and confirmed as a valid issue that is not a duplicate labels Mar 24, 2023
@dfenerski dfenerski changed the title Shims not bundled if installed under npm alias Shims not bundled if installed under npm alias for v3 Mar 24, 2023
@d3xter666 d3xter666 self-assigned this Mar 24, 2023
@d3xter666
Copy link
Contributor

d3xter666 commented Mar 24, 2023

Thanks for reaching out, @dfenerski

Indeed npm aliases are not bundled when building.

Would need to further look into this case with the team as we handle modules by path & id, so when the path is the same, the "redundant" module gets skipped. Here's the implementation: https://github.com/SAP/ui5-project/blob/main/lib/graph/projectGraphBuilder.js#L163

If you run the build with a --verbose flag, you'd get a meaningful message.

@d3xter666 d3xter666 added module/ui5-project Related to the UI5 Project module and removed needs triage Needs to be investigated and confirmed as a valid issue that is not a duplicate labels Mar 24, 2023
d3xter666 added a commit to SAP/ui5-project that referenced this issue May 4, 2023
Resolves: SAP/ui5-tooling#809

When shimmed packages are defined as dependency aliases in the
package.json, they are being excluded from the bundlig as the packager
eventually finds the real package and its path and as it's not defined
in the shim, but its alias, it gets ignored.

We need to provide more robust discovery in order to handle those cases:
- npm/cli#3
-
https://github.com/npm/rfcs/blob/main/implemented/0001-package-aliases.md
@d3xter666
Copy link
Contributor

HI @dfenerski,

The issue has been resolved in @ui5/project v3.3.0 and is available through the @ui5/cli version 3.1.2

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module/ui5-project Related to the UI5 Project module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants