Storybook: Angular storybook requires entryComponents to work on Ivy renderer

Created on 21 May 2020  路  8Comments  路  Source: storybookjs/storybook

Describe the bug
When running storybook on Angular with Ivy renderer and using dynamic components inside, it would throw an error.

To Reproduce
Steps to reproduce the behavior:
1, Clone https://github.com/VagrantAI-c/Angular-storybook-entry-components-repro (this is fresh angular project created from ng new, initialized storybook from cli and edited to have dynamic component inside)

  1. npm ci on cloned project
  2. Run npm run storybook and see error inside browser log: No component factory found for LazyComponent. Did you add it to @NgModule.entryComponents?

Expected behavior
Since Angular Ivy (9.0.0^), entryComponents is not required for dynamically constructed component, but it is not applied to storybook build. Notice there is no error when just running ng serve: lazy content is initiated normally.

System:
System:
OS: Windows 10 10.0.18362
CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
Binaries:
Node: 12.16.2 - E:\VagrantAI\progs\nvm\symlink\node.EXE
Yarn: 1.10.1 - E:\VagrantAI\progs\Yarn\bin\yarn.CMD
npm: 6.14.4 - E:\VagrantAI\progs\nvm\symlink\npm.CMD
Browsers:
Edge: 44.18362.449.0
npmPackages:
@storybook/addon-actions: ^5.3.18 => 5.3.18
@storybook/addon-links: ^5.3.18 => 5.3.18
@storybook/addon-notes: ^5.3.18 => 5.3.18
@storybook/addons: ^5.3.18 => 5.3.18
@storybook/angular: ^5.3.18 => 5.3.18

angular bug help wanted inactive

All 8 comments

The main issue is that storybook currently does not produce ivy code and that is something we need to work on.

I tried with storybook 6.0.0-beta.xx, same issue..

@VagrantAI-c for our library I had to setup a postinstall script to run ngcc then after Storybook was using Ivy view engine, but we face this issue with Ivy enabled.

"postinstall": "ngcc",

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@kroeder , could this be why I am experiencing angular issues given I am using Angular 9? I opened #11309 to address this.

I was preparing my app from Angular v9.1 to v10 following the update guide and therefore removed the entryComponents. This caused the described issue. Thanks to @chriscarpenter12 I simple changed in the package.json the postinstall from
"postinstall": "ngcc --properties es2015 browser module main --first-only"
to
"postinstall": "ngcc"

Then I ran yarn again in order to let ngcc compile the dependencies in the right way. After that a simple restarted of storybook worked.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

firaskrichi picture firaskrichi  路  61Comments

Gongreg picture Gongreg  路  58Comments

ilyaulyanov picture ilyaulyanov  路  100Comments

ChucKN0risK picture ChucKN0risK  路  74Comments

enagy27 picture enagy27  路  69Comments