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

Including global styles in preview.js is ignored in 6.5.0-alpha.16 #17234

Closed
artaommahe opened this issue Jan 13, 2022 · 2 comments
Closed

Including global styles in preview.js is ignored in 6.5.0-alpha.16 #17234

artaommahe opened this issue Jan 13, 2022 · 2 comments

Comments

@artaommahe
Copy link

Describe the bug

Including global styles in preview.js is ignored in 6.5.0-alpha.16.

// preview.(j|t)s
import '!style-loader!css-loader!sass-loader!./global.scss';
body {
  background-color: #ffe4c4;
}

Can't check with 6.4.x cause it's broken with angular (see #17039 (comment)).

To Reproduce

  • git clone https://github.com/artaommahe/storybook-issues
  • yarn install
  • yarn storybook
  • see no applied body styles for stories

System

Environment Info:

  System:
    OS: macOS 12.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 97.0.4692.71
    Safari: 15.2
  npmPackages:
    @storybook/addon-actions: 6.5.0-alpha.16 => 6.5.0-alpha.16 
    @storybook/addon-essentials: 6.5.0-alpha.16 => 6.5.0-alpha.16 
    @storybook/addon-links: 6.5.0-alpha.16 => 6.5.0-alpha.16 
    @storybook/angular: 6.5.0-alpha.16 => 6.5.0-alpha.16 
    @storybook/builder-webpack5: 6.5.0-alpha.16 => 6.5.0-alpha.16 
    @storybook/manager-webpack5: 6.5.0-alpha.16 => 6.5.0-alpha.16 

Additional context

Worked fine with 6.4.0-alpha.28 (it's used in our real apps with such global styles imports).

@ThibaudAV
Copy link
Contributor

ThibaudAV commented Jan 13, 2022

This topic has already appeared here is the summary :
The functionality is no longer supported by angular so either there is a feature made on the storybook side to take this case into account. Or use the new storybook builder provided for that.
It is perhaps feasible with a webpack config that does not conflict with that of angular 🤷‍♂️

angular/angular-cli#21893
angular/angular-cli#21747
some others ...

IMHO : I don't know how to do it. And I also think it's not a good solution for sb angular users.

In angular we configure the global style scss via the angular-cli builder and angular.json otherwise you have to do your own webpack configuration. Storybook allows the same thing

@shilman
Copy link
Member

shilman commented Jan 14, 2022

closing as dupe to #16256

@shilman shilman closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants