question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to configure Hammerjs in ng-package.json?

See original GitHub issue

Type of Issue

[ X] Bug Report
[ ] Feature Request

Description

I want to use hammerjs in my @ngu/carousel library and i can able run the project locally. then i created the library project using angular 6. then i try to build the library it throwing the error as Cannot find name 'Hammer'.

Here is my ng-package.json

{
  "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
  "dest": "../../dist/carousel",
  "lib": {
    "entryFile": "src/public_api.ts",
    "externals": {
      "@types/hammerjs": "Hammer",
      "@types/hammerjs/index": "Hammer",
      "hammerjs/hammer.js": "Hammer"
    }
  }
}

I don’t have an idea what to write in lib.external

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 3.0.3
@angular/*: 6.0.5
typescript: 2.7.2
rxjs: 6.2.1
node: 8.10.0
yarn: 1.7.0

Please include all version numbers that might be relevant, e.g. third-party libraries

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sheikalthafcommented, Aug 2, 2018

@alan-agius4 Thanks for suggestion

Mentioning the hammerjs in projects lib tsconfig.lib.json file solves the issue

"types": ["hammerjs"]

This will help someone with this issue

1reaction
alan-agius4commented, Aug 2, 2018

Replace that with ‘hammerjs’

Check here: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

On Thu, 02 Aug 2018 at 17:03, Sheik Althaf notifications@github.com wrote:

@alan-agius4 https://github.com/alan-agius4 Yes. Will you please help me how to include it?

“types”: [“node_modules/@types https://github.com/types”]

I tried this but no luck

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dherges/ng-packagr/issues/1035#issuecomment-409957769, or mute the thread https://github.com/notifications/unsubscribe-auth/AQv-Wk1YrdFQmSSUJ1qSgMsyx3FTY6cKks5uMxS-gaJpZM4Vrqw- .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add external js file in angular 6 library - Stack Overflow
Provide the reference of your external JS in your angular.json file of ... Just npm install hammerjs then edit your main.ts file and...
Read more >
angular/angular-cli - Gitter
@Destreyf fixed it by adding 2 settings to my angular-cli.json! ... node_modules/hammerjs/hammer.min.js" ], to angular-cli.json which works just fine with ...
Read more >
ng-package vs. package.json - DEV Community ‍ ‍
If we hang around building libraries in Angular we're bound to run into how these two files work toge... Tagged with angular, typescript....
Read more >
ng-packagr/ng-package.schema.json - UNPKG
22, "description": "Enable this to keep the 'scripts' section in package.json. Read the NPM Blog on 'Package install scripts vulnerability' ...
Read more >
ngx-document-scanner - CodeSandbox
ngx-document-scanner. src. README.md. karma.conf.js. ng-package.json. package.json. tsconfig.lib.json. tsconfig.spec.json. tslint.json. ngx-ds-demo-app.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found