rbren / rss-parser

A lightweight RSS parser, for Node and the browser
MIT License
1.37k stars 210 forks source link

Broken on webpack 5 #249

Open IRelaxxx opened 1 year ago

IRelaxxx commented 1 year ago

Because webpack 5 does not bundle node polyfills by default this package is broken for build systems with webpack 5.

I tried polyfilling by using tsconfig compilerOptions but you cannot polyfill modules required by dependencies of this module.

Workaround: use a bundle from /dist

tofra commented 10 months ago

How should I use the workaround? I added node_modules/rss-parser/dist/rss-parser.min.js to the scripts section in angular.json, but it still complains.

Edit: Found it! It's not nessecery to add it to angular.json. Changing import * as Parser from 'rss-parser' to import Parser from '../../../node_modules/rss-parser/dist/rss-parser.min'; worked.

jduerr commented 10 months ago

Hmmm. I encounter the same problem - but if I try to import in my angular project using import Parser from '../../../../node_modules/rss-parser/dist/rss-parser.min'; then I get an "Could not find a declaration file for module" Error. Any hints ? What could be different on my setup?

beliven-davide-lorigliola commented 7 months ago

Hmmm. I encounter the same problem - but if I try to import in my angular project using import Parser from '../../../../node_modules/rss-parser/dist/rss-parser.min'; then I get an "Could not find a declaration file for module" Error. Any hints ? What could be different on my setup?

Simply add // @ts-ignore above the import line.

legendarydrew commented 3 months ago

Using import Parser from 'rss-parser/dist/rss-parser'; in an Angular project worked for me.