ngneat/hotkeys

Error: Module not found: Error: Can't resolve '@ng-bootstrap/ng-bootstrap'

mloffer opened this issue · 5 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Missing dependency on build.

./node_modules/@ngneat/hotkeys/fesm2022/ngneat-hotkeys.mjs:8:0-49 - Error: Module not found: Error: Can't resolve '@ng-bootstrap/ng-bootstrap' in '**\@ngneat\hotkeys\fesm2022'

Error: node_modules/@ngneat/hotkeys/lib/hotkeys-help/hotkeys-help.component.d.ts:3:32 - error TS2307: Cannot find module '@ng-bootstrap/ng-bootstrap' or its corresponding type declarations.

3 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expected behavior

Should be able to follow instructions in README.md and get a working installation. No mention of dependencies that need to be manually installed.

Minimal reproduction of the problem with instructions

  1. Create a brand new Angular application
  2. Follow instructions in README.md (npm install @ngneat/hotkeys, add to app module)
  3. Run the app (ng serve)
  4. Above error occurs.

Additional observations:

  • It appears this PR added @ng-bootstrap/ng-bootstrap, @popperjs/core, and bootstrap to the test app. Without them, this package does not work. Shouldn't these be included in @ngneat/hotkeys's package.json as at least peerDependencies?
  • The PR also adds a reference for node_modules/bootstrap/scss/bootstrap.scss in angular.json's styles array.
  • The README should indicate how to provide these dependencies if not provided by the package.

Environment


Angular version: 16.2.12


Browser:
n/a
 
For Tooling issues:
- Node version: v18.17.1  
- Platform: Windows  

Others:

I'm running into this as well. Also, I have no intent to bring in bootstrap. I'm already using Angular Material and do not want to add another UI framework. Do you think it would be possible to split this library into two separate packages?

  1. Keep @ngneat/hotkeys as purely the hotkeys functionality without any UI components.
  2. Separate package for the dialog that folks can optionally bring in if they need it.

In my case, I'm actually not using any of the UI components from @ngneat/hotkeys. I rolled my own hotkeys dialog that aligns with the design of my app.

The HotkeysHelpComponent is optional, but I see the issue. We can do what you suggest, but I'd go with removing the bootstrap dependency in favor of providing a class that implements the needed methods. Do you want to create a PR?

Hello @NetanelBasal do you know when you'll release a new version including this PR #90 ?
Thanks for all your work !

Hi, if we are already introduces a breaking change maybe you can update to v17?

Hello, like so #91 ?