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.

v5.3.0-rc.12: Running build-storybook does not include scss files

See original GitHub issue

Describe the bug When attempting to run build-storybook, it builds successfully, but it does not include any of the scss style files, despite using the @storybook/preset-scss. I have also tried custom webpack setup for scss compiling, but that was also unsuccessful. The site is built, it just has absolutely no style.

It is also a TypeScript environment and has no problem with the TypeScript and tsx files.

It also works perfectly fine when running start-storybook, only build-storybook fails to work with scss files.

To Reproduce Steps to reproduce the behavior:

  1. Run build-storybook
  2. Observe the created static site

Expected behavior Should include style files as css. This worked as intended before converting the files over to main, preview etc.

Screenshots If applicable, add screenshots to help explain your problem.

Code snippets

preview.js

import { withInfo } from '@storybook/addon-info';
import { withKnobs } from '@storybook/addon-knobs';
import { addDecorator, addParameters } from '@storybook/react';
import theme from './theme';

// THESE AREN'T WORKING!!!!!
import '../src/index.scss';
import './style.scss';

addDecorator(withInfo(/* Some settings */));
addDecorator(withKnobs);

addParameters({
  options: { panelPosition: 'right', theme },
  docs: { extractComponentDescription: (_c, { info }) => info ? info : null },
});

main.js

const path = require('path');

module.exports = {
  stories: ['../src/components/**/*.stories.tsx'],
  addons: [
    '@storybook/addon-knobs/register',
    '@storybook/addon-actions/register',
    '@storybook/addon-viewport/register',
    '@storybook/addon-docs',
  ],
  presets: [
    '@storybook/preset-scss',
    {
      name: '@storybook/preset-typescript',
      options: {
        tsLoaderOptions: { ignoreDiagnostics: [7005] },
        include: [path.resolve(__dirname, '../')],
      },
    },
  ],
};

System: OS: macOS Mojave 10.14.4 CPU: (12) x64 Intel® Core™ i7-8850H CPU @ 2.60GHz Binaries: Node: 12.13.1 - /usr/local/bin/node Yarn: 1.19.2 - /usr/local/bin/yarn npm: 6.12.1 - /usr/local/bin/npm Browsers: Chrome: 79.0.3945.117 Safari: 12.1 npmPackages: @storybook/addon-actions: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/addon-docs: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/addon-info: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/addon-knobs: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/addon-viewport: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/addons: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/preset-scss: ^1.0.2 => 1.0.2 @storybook/preset-typescript: ^1.2.0 => 1.2.0 @storybook/react: ^5.3.0-rc.12 => 5.3.0-rc.12 @storybook/storybook-deployer: ^2.8.1 => 2.8.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mrmckebcommented, Jan 13, 2020

@arabold @shilman the preset clears out any customisations that are set before it is loaded, but you should be able to make changes after. It’s not something we officially support, but it should work.

If you think this is not working correctly, please raise an issue on the preset (https://github.com/storybookjs/presets/issues/new) with a reproduction and I’ll take a look! 😃

0reactions
shilmancommented, Jan 12, 2020

@arabold glad it’s working again! AFAIK webpack customization is not possible in CRA

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import scss file is not working inside storybook file
I'm using sb init to create the storybook file. Everything is working, all the addons loaded but only the style is not working....
Read more >
MIGRATION.md · Gitee 极速下载/storybook - Gitee.com
Storybook 6.x installed postcss by default. In 7.0 built-in support has been removed. IF you need it, you can add it back using...
Read more >
Webpack v5 Upgrade - `start-storybook` works but ... - Issuehunt
The start-storybook command works just fine, but when I run build-storybook , I get the following error: info @storybook/react v6.1.11 info info =>...
Read more >
CLI options - 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 >
Creating a React Component Library using Rollup, Typescript ...
If no file is provided it'll attempt to use rollup.config.js within the same directory. Now by running npm run build you should see...
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