-
Notifications
You must be signed in to change notification settings - Fork 104
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
preset-create-react-app support of craco #109
Comments
Hi @liokm, so as craco is a little different than a fork of Can you share more information about your Craco setup? It might be something we can automate. |
Hi @mrmckeb , thank you. The config is as following. I am not using
|
Hi @liokm, from what I can see, you'll need to implement this yourself for now. As Craco isn't a fork of CRA, but instead modifies it, you would need to do something like this:
We also support passing babel plugins/presets through a You can find more about From what I can see, you shouldn't need to change too much for Ant Design - in fact it works with CRA with no config - but it looks like that Craco plugin does a lot of customisation for advanced usage: We'd welcome a PR to add some level of compat with Craco, but right now it seems that this would be a large amount of work. CC @shilman who may have some other thoughts? |
I just moved to using craco to apply the craco-cesium fixes to use cesium. const cracoCesium = require( "craco-cesium" )()
module.exports = {
stories: ["../src/**/*.stories.tsx"],
addons: [
"@storybook/preset-create-react-app",
"@storybook/addon-actions",
"@storybook/addon-links",
],
webpackFinal( config, { configType } ) {
// run craco plugins since there is no preset for craco
return cracoCesium.overrideWebpackConfig( {
webpackConfig: config,
context: {
env: configType.toLowerCase(),
},
} );
},
}; |
I hit problems with Craco and storybook last night so built an experimental preset based on preset-create-react-app to use the webpack config from Craco instead of pulling it directly from react-scripts. This means any Craco plugins, changes postcss plugins, manual webpack tweaks, etc will also be applied to storybook. Its a bit hackey at the moment and calls out to internal apis inside preset-create-react-app but that seemed like a better choice than re-inventing the wheel. Any feedback, contributions, fixes, etc are welcome, it would be good to have solid integration between storybook and Craco. |
@danielknell first, thanks! Worked a treat and seems like the most sensible+DRY way of handling craco configs. FYI: I'm using craco to customise |
Thanks a lot @danielknell for your work on https://github.com/artisanofcode/storybook-preset-craco cause it works great! |
When @craco/craco is used as a replacement of
react-scripts
, there is no fork ofreact-scripts
, thus this line, which tries to require the non-existing module.../@craco/craco/index.js/config/webpack.config
, will fail.Although we could solve the issue by either providing a local
react-scripts
or mocking the module, I want to know whether there is any plan forpreset-create-react-app
to support user provided entire webpack config. Thanks a lot.The storybook config looks like
The text was updated successfully, but these errors were encountered: