custom-react-scripts icon indicating copy to clipboard operation
custom-react-scripts copied to clipboard

Storybook - Support

Open omariosouto opened this issue 8 years ago • 6 comments

Hi, how are you all?

I was creating a new setup with https://github.com/storybooks/storybook, and when I Include an stylus file the storybook can`t read the file because they need to add an extension for webpack for make everything work.

How could I implement this?

omariosouto avatar Jul 31 '17 21:07 omariosouto

If I remember correctly, you need to do this via Storybook's Extend Mode.

frankstallone avatar Oct 11 '17 23:10 frankstallone

You could pass an example of the webpack.config. I can not make me recognize the scss styles

fgvicente avatar Jun 14 '18 12:06 fgvicente

I think your asking me for an example @fgvicente? If so here is my current .storybook/webpack.config.js. This works with my TypeScript, loads my static folder files appropriately and compiles my SCSS.

// load the default config generator.
const path = require('path');

module.exports = (baseConfig, env, defaultConfig) => {
  defaultConfig.resolve.extensions.push('.ts', '.tsx');

  defaultConfig.module.rules.push({
    test: /\.(ts|tsx)$/,
    loader: "ts-loader",
    options: {
      // absolute path from the current process directory if you want to use your own
      configFile: path.join(process.cwd(), './tsconfig.declaration.json')
    }
  });

  defaultConfig.module.rules.push({
    test: /\.(woff|woff2|eot|ttf|svg|gif|png)$/,
    loader: "file-loader"
  });

  defaultConfig.module.rules.push({
    test: /\.(scss|sass)$/,
    loaders: ["style-loader", "css-loader", "resolve-url-loader", "sass-loader?sourceMap"],
  });

  return defaultConfig;
};

frankstallone avatar Jun 14 '18 12:06 frankstallone

@frankstallone thank for help but not work. image image image

fgvicente avatar Jun 14 '18 14:06 fgvicente

I don't think Storybook would even properly start if your SCSS file wasn't properly handled in webpack therefore as far as this issue is concerned it sounds like you are loading it properly now.

Your pointing to line 2 in a completely different file and I have no context as to what you are even showing in your last image. Start a new issue and breakdown your question a little further.

@omariosouto should consider closing this ticket if is indeed a solved problem.

frankstallone avatar Jun 14 '18 14:06 frankstallone

@frankstallone I explain myself a little better. NO error storybook now, but I do not load the css. the second image shows the button without the styles and in the console it also does not show that it loads a class

fgvicente avatar Jun 14 '18 14:06 fgvicente