How to import third party libraries in project?


#1

Simple as that.

I can’t believe it is so difficult to import a simple npm module as

‘rss-parser’

into a Stencil project.

I installed it and tried to use it with

import { rss-parser } from ‘rss-parser’

and a lot of different syntax for importing it. I just cant get it to work. What am I still doing wrong after 10 hours?
Is this a bundler problem or am I missing something else? Im pretty new to ionic/stencil.

Thanks for your help!


#2

hello,
as the repo do not provide an example for proper import, you can try different things. For example entrys inside bracket pairs starts with uppercase. Import {Rss…

If you use visual code, then its makes life much more easier using extension that helps with imports like npm Intellisense, etc… If you use something different, then look their if they have something like that.

Best regards, anna-liebt


#3

If i try this:

let Parser = require('rss-parser');
let parser = new Parser();

I get the Error:

Can’t find variable: require


#4

I have the same problem with other libs… if you get it please let me know !


#5

See: https://momentjs.com/docs/#/use-it/typescript/


#6

Thaks for the info… i test and works with the example… but with the lib that i have does not works