rbren / rss-parser

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

Error: Cannot find module 'https', 2 import { RequestOptions } from 'https'; with Angular 11 #198

Open janlycka opened 3 years ago

janlycka commented 3 years ago

Hi, I get an error trying to use this module with Angular 11. Possibly due to deprecation as RequestOptions have long since been replaced with HttpClient

$ ng serve
- Generating browser application bundles...
√ Browser application bundle generation complete.

Initial Chunk Files   | Names         |    Size
main.js               | main          | 0 bytes
polyfills.js          | polyfills     | 0 bytes
runtime.js            | runtime       | 0 bytes
styles.css, styles.js | styles        | 0 bytes
vendor.js             | vendor        | 0 bytes

| Initial Total | 0 bytes

Build at: 2021-03-16T01:31:32.271Z - Hash: 2...4 - Time: 22616ms

Warning: C:\Users\...\blog.component.ts depends on 'rss-parser'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Error: node_modules/rss-parser/index.d.ts:2:32 - error TS2307: Cannot find module 'https' or its corresponding type declarations.

2 import { RequestOptions } from 'https';

I'm running Angular 11

$ ng version

...

Angular CLI: 11.2.3
Node: 12.16.2
OS: win32 x64

Angular: 11.2.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.3
@angular-devkit/build-angular   0.1102.3
@angular-devkit/core            11.2.3
@angular-devkit/schematics      11.2.3
@angular/cdk                    11.2.4
@angular/cli                    11.2.3
@angular/material               11.2.4
@schematics/angular             11.2.3
@schematics/update              0.1102.3
rxjs                            6.6.6
typescript                      4.1.5

I tried replacing RequestOptions with HttpClient but it seems that then I'd have to rewrite the whole module. Perhaps I'm missing something since nobody else on here seems to complain and there are thousands of users. Could you have a look?

Cheers & KR

gudipudiramanakumar commented 3 years ago

Yeah, I'm having the same issue

yatobjection commented 3 years ago

In your package.json you have to add:

"browser": {
    "http": false,
    "https": false
}

But now, i've this problem: ERROR Error: Uncaught (in promise): TypeError: get is not a function

If somebody know how can i solve that...

JoshFoshT commented 3 years ago

Were you able to find a solution for this?

FrancescoPaiola commented 2 years ago

Same problem