ngx-utils / cookies

Manage your cookies on client and server side (Angular Universal)
MIT License
39 stars 27 forks source link

Import fails when using Ivy compiler due to package not following Angular Package Format #17

Closed sebastiangug closed 4 years ago

sebastiangug commented 5 years ago

I'm getting

ERROR in src/app/app.module.ts(75,12): error TS-991010: Value at position 1 in the NgModule.imports of AppModule is not a reference: [object Object]

when trying to import

BrowserCookiesModule.forRoot(),

I've digged a bit into this issue on Ivy's github and it seems that this package does not follow the APF (Angular Package Format);

sebastiangug commented 5 years ago

Importing it without forRoot and manually adding

  { provide: COOKIES_OPTIONS, useValue: {} },
    CookiesOptionsService,
    { provide: CookiesService, useClass: BrowserCookiesService }

then throws:

@ngx-utils/cookies/src/browser/browser-cookies.module.d.ts:3:22 - error TS-996002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class

3 export declare class BrowserCookiesModule {

Which must mean ther's something wrong with the way the declaration files are generated.

sebastiangug commented 5 years ago

Copy pasting the source code into a temp subfolder for it to be compiled alongside the rest of the files works but is obviously not a permanent solution.

DeepSnowNeeL commented 4 years ago
ERROR in ../../../node_modules/@ngx-utils/cookies/src/browser/browser-cookies.module.d.ts:4:47 - error TS-996005: BrowserCookiesModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.

Just updated to angular 9-rc7 and this appears (linked to this issue), if someone could fix it and ping me when done (or if a better/active fork exists) thx

itstueben commented 4 years ago

Same Issue as @DeepSnowNeeL

we consume a package that has n dep on cookies

thebaron24 commented 4 years ago

I am using the new Angular 9 with Ivy by default and I am also getting the same issue as @DeepSnowNeeL .

daniloff200 commented 4 years ago

Same for me, tried to migrate my app today to Angular 9, and got exactly the same.

daniloff200 commented 4 years ago

Well, I've created a PR with migration to NG9, and updating types in moduleWithProviders, I think, that should help

Most likely the author of this library will not merge that, so, feel free to try to use my fork https://github.com/daniloff200/cookies

sebastiangug commented 4 years ago

@daniloff200 you've understimated him haha

daniloff200 commented 4 years ago

@michaelbats yeah, suddenly appeared, that we live in one city, and I know some folks from his company, so, contacted him and asked for merge

I hope, that in 4.0.1 version all NG9 issues will be fixed, at least, that helped me today with my migration to Angular 9