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.

Adrian Brand
  • 20,384
  • 4
  • 39
  • 60
  • 3
    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. – Shy Agam Aug 14 '20 at 08:01

2 Answers2

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.

DrakeAnglin
  • 718
  • 1
  • 4
  • 12
  • 1
    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. – Adrian Brand Oct 30 '21 at 00:04
  • 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. – DrakeAnglin Dec 09 '21 at 15:07
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

Simon
  • 81
  • 6
  • 1
    It is from their side in [this tweet](https://twitter.com/stackblitz/status/1380501561311330309), They acknowledged it here and actually suggested your solution to turn Ivy off – Ahmed Mohamedeen Apr 16 '21 at 18:07
  • @AhmedMohamedeen the question states it works with Ivy off. But it makes my library look bad if importing it crashes a StackBlitz. – Adrian Brand Apr 17 '21 at 03:16
  • @AdrianBrand i think Simon have answer to your original question. Please consider validate it – Yanis-git Oct 26 '21 at 18:25