-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Cannot seem to import CSS into storybook using a create-react-app generated project. #3685
Comments
Additional info. Tried changing the import in
Which is a somewhat improved error... I now get a bunch of errors about not being able to load fonts and svg images:
|
okay... so I found the solution to my issue, which points out the fact I probably didn't fully read the docs for full control This was my fix using module.exports = (storybookBaseConfig, configEnv) => {
fixAMDSwaggerClient(storybookBaseConfig, configEnv);
storybookBaseConfig.module.rules.push(
{
test: /\.(woff|woff2|eot|ttf|svg|gif|png)$/,
use: 'url-loader'
});
return storybookBaseConfig;
}
const fixAMDSwaggerClient = (config, env) => {
config.module.rules.push({
test: /sunflower-client\/.*\.js$/,
use: 'imports-loader?define=>false'
})
} |
Bug or support request summary
Trying to import CSS in storybook config.js within a create-react-app app.
I keep getting this error when I run
yarn run storybook
:Steps to reproduce
This is what I've done for configuration of Storybook:
I am using LESS, however I'm pre-generating the CSS using this sort of configuration in my
package.json
:Which is the current recommended way to deal with style transpilers in CRA.
Also due to some other issue, related to a Swagger generated client and CRA, it had to rewire the the CRA to disable Webpack AMD module detection, which I've duplicated within my
.storybook/webpack.config.js
like so:Within my
config.js
, I've got the following defined:I have tried the various suggestions referenced in #1603, however none of those solutions seem to work, and actually produce even more errors (
publicPath
is undefined)Not sure how to proceed.
Please specify which version of Storybook and optionally any affected addons that you're running
Affected platforms
The text was updated successfully, but these errors were encountered: