question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storybook doesn't run in dev mode with hot reload like `start-storybook`

See original GitHub issue

Current Behavior

I have storybook set up with NX and Angular. Everything is working fine except I am forced to run nx run storybook:<my-project> after every change I make. start-storybook runs this as a dev server with hot module reloading. Am I missing a cli option to get this, or is nx using the wrong builder?

Expected Behavior

I would expect serving storybook to have hot reloading available.

Steps to Reproduce

Set up an NX project with storybook configuration and run the nx run storybook:<project> command.

Environment

Node : 17.3.0
  OS   : darwin x64
  npm  : 8.3.0
  
  nx : 13.4.4
  @nrwl/angular : 13.4.4
  @nrwl/cli : 13.4.4
  @nrwl/cypress : 13.4.4
  @nrwl/devkit : 13.4.4
  @nrwl/eslint-plugin-nx : 13.4.4
  @nrwl/express : undefined
  @nrwl/jest : 13.4.4
  @nrwl/linter : 13.4.4
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : undefined
  @nrwl/nx-cloud : undefined
  @nrwl/react : undefined
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.4.4
  @nrwl/web : undefined
  @nrwl/workspace : 13.4.4
  @nrwl/storybook : 13.4.4
  @nrwl/gatsby : undefined
  typescript : 4.4.4
  rxjs : 7.4.0
  ---------------------------------------
  Community plugins:
  	 @angular/animations: 13.1.1
  	 @angular/common: 13.1.1
  	 @angular/compiler: 13.1.1
  	 @angular/core: 13.1.1
  	 @angular/forms: 13.1.1
  	 @angular/platform-browser: 13.1.1
  	 @angular/platform-browser-dynamic: 13.1.1
  	 @angular/router: 13.1.1
  	 @compodoc/compodoc: 1.1.18
  	 @angular-devkit/build-angular: 13.1.2
  	 @angular/cli: 13.1.2
  	 @angular/compiler-cli: 13.1.1
  	 @angular/language-service: 13.1.1
  	 @storybook/angular: 6.5.0-alpha.13

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Coly010commented, Feb 1, 2022

Hey @sir-captainmorgan21 ! I’ve pushed a PR with the fix to this. I’ve copied the explanation as to why this occurred below:

Explanation

Storybook’s app/angular/src/server/framework-preset-angular-cli.ts file has code in it that merges three configs.

It merges in the following order

We were passing watch: true from our executor, but it was being overridden by the watch value it was reading from the angular.json/workspace.json/project.json. This is partially because the default build configuration for Angular apps is now production.

Storybook providing the angularBuilderOptions and merging it last gave us an option to pass the watch flag using it.

2reactions
coltpinicommented, Jan 12, 2022

I am seeing the same behavior. I staying up to date with the @next releases of storybook (currently 6.5.0.alpha.15). I have storybook working, but it doesn’t hot reload, or even update with a manual reload, I have to kill and restart storybook to get any changes. I looked into changing the executor, but don’t see that config anywhere in my project. I am new to Nx, so I am probably just missing something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLI options - Storybook
Storybook comes with two CLI utilities: start-storybook and build-storybook . Storybook collects completely anonymous data to help us improve user ...
Read more >
Frequently Asked Questions - Storybook - JS.ORG
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
Configure Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
Build UI components - Storybook Tutorials
⚡️Developer experience tooling like Hot Module Reloading; Supports many view layers, including React. Install and run Storybook with the following commands:
Read more >
Environment variables - Storybook - JS.ORG
You can use environment variables in Storybook to change its behavior in different “modes”. If you supply an environment variable prefixed with STORYBOOK_ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found