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

StoryBook 5.3.12 fail add rules, work on 5.1.10 #9800

Closed
gwmaster opened this issue Feb 9, 2020 · 13 comments
Closed

StoryBook 5.3.12 fail add rules, work on 5.1.10 #9800

gwmaster opened this issue Feb 9, 2020 · 13 comments
Labels
Milestone

Comments

@gwmaster
Copy link

gwmaster commented Feb 9, 2020

If you are reporting a bug or requesting support, start here:

Bug or support request summary

try to load less on my starter project
https://github.com/gwmaster/reactStarter
example
https://github.com/gwmaster/reactStarter/tree/master/src/appsDevelop/starterProject/components/Avatar

Steps to reproduce

5.3.12 don't work
.storybook/main.js

const path = require('path');

module.exports = {
    stories: ['../src/**/*.stories.[tj]s'],
    addons: [
        '@storybook/preset-create-react-app',
        '@storybook/addon-actions',
        '@storybook/addon-links',
        '@storybook/addon-storysource',
        '@storybook/addon-knobs',
    ],
    webpackFinal: async (config, { configType }) => {
        config.module.rules.push({
            test: /\.less$/,
            loaders: [
                'style-loader',
                'css-loader',
                {
                    loader: 'less-loader',
                    options: {
                        modifyVars: {},
                        javascriptEnabled: true
                    }
                }
            ],
            include: [
                path.resolve(__dirname, '../src'),
                /[\\/]node_modules[\\/].*antd/
            ]
        });
        console.log('less config')
        // Return the altered config
        return config;
    },
};

work on 5.1.10
.storybook/webpack.config.js

const path = require('path');
module.exports = async ({ config, mode }) => {


  config.module.rules.push({
      test: /\.less$/,
      loaders: [
          'style-loader',
          'css-loader',
          {
              loader: 'less-loader',
              options: {
                  modifyVars: {},
                  javascriptEnabled: true
              }
          }
      ],
      include: [
        path.resolve(__dirname, '../src'),
        /[\\/]node_modules[\\/].*antd/
      ]
  });
  return config;
};

@shilman shilman added this to the 5.3.x milestone Feb 9, 2020
@shilman shilman added the cra Prioritize create-react-app compatibility label Feb 9, 2020
@shilman
Copy link
Member

shilman commented Feb 9, 2020

Cc @mrmckeb

@mrmckeb
Copy link
Member

mrmckeb commented Feb 10, 2020

This is an interesting one, sorry you've hit this @gwmaster. We don't officially support modifying the CRA config, but what you're doing should work.

Can you try adding that rule in before CRA's oneOf configuration?

Also, can I suggest you look to use CRA's new template feature for your starter? It might suit you better :)

@gwmaster
Copy link
Author

gwmaster commented Feb 10, 2020

i upgrade to 6.0.0-alpha.9 and now its work
https://github.com/gwmaster/reactStarter
i build my starter to support multiple project on same basic configuration
and share local common components

@mrmckeb
Copy link
Member

mrmckeb commented Feb 11, 2020

@shilman is there anything in 6.x that would have made a difference here? I'm a little confused by what's happened - but have been out of the loop.

@shilman
Copy link
Member

shilman commented Feb 11, 2020

@mrmckeb i'm not sure what's going on here. there has been some drama around MiniCssExtractPlugin, e.g. #9777 (comment), but I haven't tracked down the current status in 6.0/5.3 to know what's going on. @ndelangen was looking into this.

@ndelangen
Copy link
Member

I nuked the MiniCssExtractPlugin, because it was giving nothing but grief.

5.3 should work fine with the cra preset configured.

@shilman
Copy link
Member

shilman commented Feb 12, 2020

Releasing this now as 5.3.13. Hoping it will fix peoples' problems and not cause new ones 🙈

@mrmckeb
Copy link
Member

mrmckeb commented Mar 1, 2020

Hi all, is this still an issue? Or can we close this off?

@gwmaster
Copy link
Author

gwmaster commented Mar 4, 2020

ok i definitely find how reproduce the problem
why this happen i don't know
load my
https://github.com/gwmaster/reactStarter
if node_modules have 'react-scripts' less don't loaded!
antd button no less styles
image

work after delete 'react-scripts'
antd less styles loaded
image
the storybook throw error
image

@mrmckeb
Copy link
Member

mrmckeb commented Mar 4, 2020

Hi @gwmaster, if react-scripts is detected in the project, that webpack config will be used for Storybook.

It looks like you've got multiple configurations in that project. CRA doesn't support Less, are you modifying it?

@gwmaster
Copy link
Author

gwmaster commented Mar 5, 2020

if not include react-scripts StoryBook write failed .
does this impact ?
i have in .storybook/main.js less rule

@stale
Copy link

stale bot commented Mar 26, 2020

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!

@stale stale bot added the inactive label Mar 26, 2020
@stale
Copy link

stale bot commented Apr 25, 2020

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!

@stale stale bot closed this as completed Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants