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 8 AOT #337

Closed
jbonet opened this issue Jun 8, 2020 · 10 comments
Closed

Angular 8 AOT #337

jbonet opened this issue Jun 8, 2020 · 10 comments
Labels

Comments

@jbonet
Copy link

jbonet commented Jun 8, 2020

Works as expected in dev builds.

As soon as AOT is enabled, errors come up.

Module not found: Error: Can't resolve '@casl/ability/dist/types/Ability'

Is CASL not compatible with Angular 8?

@jbonet jbonet closed this as completed Jun 8, 2020
@jbonet jbonet reopened this Jun 8, 2020
@antony2809
Copy link

Having the same problem on my project. Any solution for this?

@Olena-Stotska
Copy link
Collaborator

yes, looks like it doesn't work with Angular 8. And as always Angular errors are very helpful...

@antony2809
Copy link

yes, looks like it doesn't work with Angular 8. And as always Angular errors are very helpful...

Yeah ofc, forgot about it. Is just give the errors when aot is enabled on the build

ERROR in ./src/app/app.module.ngfactory.js Module not found: Error: Can't resolve '@casl/ability/dist/types/Ability' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app' ERROR in ./src/app/modules/home/home.module.ngfactory.js Module not found: Error: Can't resolve '@casl/ability/dist/types/Ability' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\home' ERROR in ./src/app/modules/user/services/user.service.ts Module not found: Error: Can't resolve '@casl/ability/dist/types/Ability' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\user\services' ERROR in ./src/app/app.module.ngfactory.js Module not found: Error: Can't resolve '@casl/ability/dist/types/PureAbility' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app' ERROR in ./src/app/modules/navigation-bar/components/navigation-navigate/navigation-navigate.component.ngfactory.js Module not found: Error: Can't resolve '@casl/ability/dist/types/PureAbility' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\navigation-bar\components\navigation-navigate' ERROR in ./src/app/modules/startups/modules/startup-discover/components/startup-filter-component/startup-filter.component.ngfactory.js Module not found: Error: Can't resolve '@casl/ability/dist/types/PureAbility' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\startups\modules\startup-discover\components\startup-filter-component' ERROR in ./src/app/app.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app' ERROR in ./src/app/modules/collections/collections.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\collections' ERROR in ./src/app/modules/dealflow/dealflow.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\dealflow' ERROR in ./src/app/modules/events/events.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\events' ERROR in ./src/app/modules/home/home.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\home' ERROR in ./src/app/modules/investment-tracker/investment-tracker.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\investment-tracker' ERROR in ./src/app/modules/smart-sheets/modules/smart-sheets-detail/smart-sheets-detail.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\smart-sheets\modules\smart-sheets-detail' ERROR in ./src/app/modules/smart-sheets/modules/smart-sheets-directory/smart-sheets-directory.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\smart-sheets\modules\smart-sheets-directory' ERROR in ./src/app/modules/startups/modules/startup-discover/startup-discover.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\startups\modules\startup-discover' ERROR in ./src/app/modules/today/today.module.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/AbilityModule' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\today' ERROR in ./src/app/modules/navigation-bar/components/navigation-navigate/navigation-navigate.component.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/pipes' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\navigation-bar\components\navigation-navigate' ERROR in ./src/app/modules/startups/modules/startup-discover/components/startup-filter-component/startup-filter.component.ngfactory.js Module not found: Error: Can't resolve '@casl/angular/dist/types/pipes' in 'C:\Users\Anthony\Desktop\Development\playbook\Playbook-Frontend\frontend\src\app\modules\startups\modules\startup-discover\components\startup-filter-component'

@Olena-Stotska
Copy link
Collaborator

use @casl/angular-v2.1.1 as a workaround, it should work. The latest one for sure works with v9. Maybe the issue due to using angular cli 9 to compile package

@antony2809
Copy link

antony2809 commented Jun 8, 2020

@Olena-Stotska Yes, actually I have a different project with Angular 9 and is working perfectly. Just broke in Angular 8. Thanks for the anwer

@antony2809
Copy link

@Olena-Stotska is @casl/ability-v4.1.3 compatible with @casl/angular-v2.1.1

@Olena-Stotska
Copy link
Collaborator

Olena-Stotska commented Jun 8, 2020

This is what we need to investigate :)

Update: @casl/angular uses only 1 method - Ability#can, the issue may be in types

@antony2809
Copy link

Yeah, it works now. Thank you

@Olena-Stotska
Copy link
Collaborator

fixed in @casl/[email protected] and @casl/[email protected]. Guys, please test!

@Olena-Stotska
Copy link
Collaborator

angular example app works fine, so close this.

Thanks for the issue!

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

No branches or pull requests

3 participants