File tree Expand file tree Collapse file tree 3 files changed +96
-69
lines changed
Expand file tree Collapse file tree 3 files changed +96
-69
lines changed Original file line number Diff line number Diff line change @@ -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 ) {
You can’t perform that action at this time.
0 commit comments