11import type { StorybookConfig } from '@storybook-vue/nuxt'
22
33const config = {
4- stories : [ '../app/**/*.stories.@(js|ts)' ] ,
4+ stories : [ '../.storybook/*.mdx' , '../ app/**/*.stories.@(js|ts)'] ,
55 addons : [ '@storybook/addon-a11y' , '@storybook/addon-docs' , '@storybook/addon-themes' ] ,
66 framework : '@storybook-vue/nuxt' ,
77 staticDirs : [ './.public' ] ,
@@ -11,6 +11,33 @@ const config = {
1111 async viteFinal ( newConfig ) {
1212 newConfig . plugins ??= [ ]
1313
14+ // Bridge compatibility between Storybook v10 core and v9 @storybook -vue/nuxt
15+ // v10 expects module federation globals that v9 doesn't provide
16+ newConfig . plugins . push ( {
17+ name : 'storybook-v10-compat' ,
18+ transformIndexHtml : {
19+ order : 'pre' ,
20+ handler ( html ) {
21+ const script = `
22+ <script>
23+ // Minimal shims for Storybook v10 module federation system
24+ // These will be replaced when Storybook runtime loads
25+ window.__STORYBOOK_MODULE_GLOBAL__ = { global: window };
26+ window.__STORYBOOK_MODULE_CLIENT_LOGGER__ = {
27+ deprecate: console.warn.bind(console, '[deprecated]'),
28+ once: console.log.bind(console),
29+ logger: console
30+ };
31+ window.__STORYBOOK_MODULE_CHANNELS__ = {
32+ Channel: class { on() {} off() {} emit() {} once() {} },
33+ createBrowserChannel: () => new window.__STORYBOOK_MODULE_CHANNELS__.Channel()
34+ };
35+ </script>`
36+ return html . replace ( / < s c r i p t > / , script + '<script>' )
37+ } ,
38+ } ,
39+ } )
40+
1441 newConfig . plugins . push ( {
1542 name : 'ignore-internals' ,
1643 transform ( _ , id ) {
0 commit comments