Add support for Storybook custom builder
See original GitHub issueCurrently storybook requires either webpack or webpack5 set in the { core: { builder: '...' } }
I’ve been wanting to use more custom builder for plugins without having to fork the whole storybook integration. For example:
const rootMain = require('../../../.storybook/main');
module.exports = {
...rootMain,
core: { ...rootMain.core, builder: '@storybook/builder-vite' },
stories: [
...rootMain.stories,
'../src/lib/**/*.stories.mdx',
'../src/lib/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [...rootMain.addons, '@nrwl/react/plugins/storybook'],
async webpackFinal(config, { configType }) {
// apply any global webpack configs that might have been specified in .storybook/main.js
if (rootMain.webpackFinal) {
config = await rootMain.webpackFinal(config, { configType });
}
// add your own webpack tweaks if needed
return config;
}
};
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Configure Storybook
To control the way stories are rendered and add global decorators and parameters, create a .storybook/preview.js file. This is loaded in the Canvas...
Read more >[Feature] Angular 6 Builder #3995 - storybookjs/storybook
Solve multiple issues [Support] Storybook + Angular 6 multiple apps ... I can't think of a reason Storybook should add a builder for...
Read more >How to build a Storybook addon - Chromatic
UI-based addons · 1. You can add a tool to the Toolbar, for example the Grid and Background tools · 2. Create an...
Read more >Angular: Storybook Webpack Migration - Nx
The easiest way is probably to generate a new library and Storybook configuration and then copy & paste the main.js . 2. Move...
Read more >The specified command ("storybook") is invalid. For a list of ...
im my angular 13.1.1 application i added storybook and manually adding angular cli build option to the project so that it will use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Jordan-Hall ! I’m testing this out, right now!
Sooooo, great news!!!
I just tested this! I installed
vite
and@storybook/builder-vite
. Then, in my React projects’s.storybook/main.js
I changed the builder to this:builder: '@storybook/builder-vite'
.Then I just did
nx storybook my-project
and it works like a charm.Here is my repo. I had to do nothing more, it just works! I just need to remove that webpack4 message, which is disorienting! Here are the changes from the default Storybook setup as Nx creates it, to move to vite.
Please please let me know if it works for you!
You can also read the docs on the vite builder!
I’ll let you know if this is exactly the issue. WIth the setup I have it appears to still be running on webpack (At least thats what it says). I notice now https://github.com/nrwl/nx/issues/10584 is saying bable-loader being used so will need to debug for longer. However at the same time all the viteFinal config is being called as expected.