I'm trying to include this zookeeper's library in my Angular 2 project. I'm following this tutorial , so I created the app, installed the node-zookeeper-client with rpm, and then added ../node_modules/node-zookeeper-client/index.js
to my script array in the .angular-cli.json.
If I start the application, in the console I see an error like ReferenceError: Can't find variable: require
that points to the first line of the index.js file.
Which is the correct approach to import a third party library like zookeeper?
Thanks
Here's how you should solve it if you are using angular cli. In your
src/typings.d.ts
paste the below code. It will work like charm
declare var require: any;
Hope this will help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.