Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 6 Support #23

Closed
Avejack opened this issue May 4, 2018 · 13 comments · Fixed by #24
Closed

Angular 6 Support #23

Avejack opened this issue May 4, 2018 · 13 comments · Fixed by #24

Comments

@Avejack
Copy link

Avejack commented May 4, 2018

Hey!
What do you think about adding Angular 6 Support?
I am not sure but i think it would not be possible to support older versions then... Maybe a ng6 branch? The Problem is that Angular 6 is using the RxJS v6 and there imports have changed. Also "takeUntil" now needs to be piped and stuff. I can make a PR for that but i don't know how you feel about the fact that this may lead to a breaking change in a way where it won't support older Angular versions anymore...

@macjohnny
Copy link
Member

I think this is a great idea, and I would appreciate it if you could help me with that.
We are already using piped rxjs operators, as e.g. in
https://github.com/bithost-gmbh/ngx-mat-select-search/blob/master/src/app/mat-select-search/mat-select-search.component.ts#L18

so this shouldn't be an issue, don't you think so?
did you try using the existing version 1.0.5 with angular 6?

@Avejack
Copy link
Author

Avejack commented May 4, 2018

Strange... You are right! It should work. But when i try to start my app i get this output:

ERROR in ./node_modules/ngx-mat-select-search/esm5/ngx-mat-select-search.js Module not found: Error: Can't resolve 'rxjs/Subject' in '\node_modules\ngx-mat-select-search\esm5' ERROR in ./node_modules/ngx-mat-select-search/esm5/ngx-mat-select-search.js Module not found: Error: Can't resolve 'rxjs/operators/take' in '\node_modules\ngx-mat-select-search\esm5' ERROR in ./node_modules/ngx-mat-select-search/esm5/ngx-mat-select-search.js Module not found: Error: Can't resolve 'rxjs/operators/takeUntil' in '\node_modules\ngx-mat-select-search\esm5'

@Avejack
Copy link
Author

Avejack commented May 4, 2018

i guess this is the problem (after npm i ngx-mat-select-search):

npm WARN ngx-mat-select-search@1.0.5 requires a peer of rxjs@^5.5.2 but none is installed. You must install peer dependencies yourself.

@Avejack
Copy link
Author

Avejack commented May 4, 2018

So i guess the problem is ^5.5.2 does not include ^6.0.0 which Angular 6 depends on:
https://github.com/angular/angular/blob/master/CHANGELOG.md

So for Angular 6 Support we would need to update rxjs to 6.0.0... I wonder if that would break the support for older Angular versions...

@macjohnny
Copy link
Member

we could specify the dependency as follows:

"rxjs": "^5.5.2 || ^6.0.0"

but in your case, there should already be a rxjs version in the node_modules folder. could you please check that this is the case?

@Avejack
Copy link
Author

Avejack commented May 4, 2018

Yeah i already have the rxjs 6.1.0 in my node_modules folder. Its kind of strange. For some reason it can't be resolved in the esm5 folder...

VSCode even recognizes every import when i open this module from the node_modules folder

@macjohnny
Copy link
Member

in https://stackblitz.com/github/Avejack/ngx-mat-select-search it seems to work with angular 6...
maybe it is related to packaging...

@macjohnny
Copy link
Member

@Avejack I can reproduce your errors with a new angular project with the following versions:
Angular CLI: 6.0.0
Node: 8.9.1
OS: win32 x64
Angular: 6.0.0

Module not found: Error: Can't resolve 'rxjs/Subject'

@Avejack
Copy link
Author

Avejack commented May 4, 2018

yeah... totally strange.

@Avejack
Copy link
Author

Avejack commented May 4, 2018

There is another problem:
in RxJS 6 import { Subject } from 'rxjs/Subject'; is not valid.
you have to do: import { Subject } from 'rxjs';

@macjohnny
Copy link
Member

I also tried re-building the package with angular cli 1.7.4 and ng-packagr 2.4.2 - with the same result.

@macjohnny
Copy link
Member

@Avejack the imports could finally be changed to be compatible with Angular 5.x.x and 6.x.x by changing

import { Subject } from 'rxjs/Subject';	
import { take } from 'rxjs/operators/take';	
import { takeUntil } from 'rxjs/operators/takeUntil';

to

import { Subject } from 'rxjs';
import { take, takeUntil } from 'rxjs/operators';

@Avejack
Copy link
Author

Avejack commented May 5, 2018

nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants