StackBlitz ngcc failed to run on my npm library with Ivy enabled
Asked Answered
B

2

21

I have published an Angular 10 library to npm and it works fine in a local Angular 10 project with Ivy enabled but if I try and use it on StackBlitz I have to disable Ivy.

https://stackblitz.com/edit/angular-ivy-tapxx5?file=tsconfig.json

but working with Ivy disabled

https://stackblitz.com/edit/angular-ivy-vbpzem?file=tsconfig.json

Not sure why I would have to turn Ivy off for StackBlitz but I can use it fine in a local CLI Ivy project.

Betancourt answered 13/8, 2020 at 1:49 Comment(1)
Facing the same issue as we speak. Got a clue for you: My library (lib1) depends on another library of mine (lib2) which depended on lodash. StackBlitz was failing for both lib1 and lib2. I removed the dependency on lodash and created my own simplified functions. Now lib2 works but StackBlitz still complains about lib1. Please post updates here. πŸ™ – Valentinavalentine
F
2

I was able to get this to work by going to the settings on the left panel and disabling Enable Ivy then doing a hard refresh on the browser.

Fluff answered 28/10, 2021 at 21:30 Comment(2)
But this is unhelpful for people who want to use my library in a StackBlitz, I feel it makes the library look bad when it doesn't work with Ivy. – Betancourt
Yes, but StackBlitz is not being used to build apps, its being used to quickly test and share code. You then will most likely take that code into a real repository and build and send it to your real environments from there. During those builds Evy can be turned on. – Fluff
R
1

This is apparently a recent recurring issue which has been filed on their GitHub repo. Similar cases are rising, working with Ivy off.

I think it is safe to assume the problem is from their part, as long as packages are running fine on regular environments.

https://github.com/stackblitz/core/issues/1364

Edit: as Ahmed pointed out, confirmed by the StackBlitz team on Twitter

Reinhard answered 16/4, 2021 at 13:44 Comment(3)
It is from their side in this tweet, They acknowledged it here and actually suggested your solution to turn Ivy off – Inkhorn
@AhmedMohamedeen the question states it works with Ivy off. But it makes my library look bad if importing it crashes a StackBlitz. – Betancourt
@AdrianBrand i think Simon have answer to your original question. Please consider validate it – Semiotics

© 2022 - 2024 β€” McMap. All rights reserved.