storybook [Bug]: IconGallery 与 SvelteKit 不兼容

6l7fqoea  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(53)

描述bug

https://storybook.js.org/docs/svelte/writing-docs/doc-block-icongallery 中,有一个示例展示了如何使用一个 IconGallery。然而,当我尝试将其与 SvelteKit 一起使用时,它只是崩溃了。
示例:

import { Meta, Title, IconGallery, IconItem } from '@storybook/addon-docs'
import AcademicCap from '../lib/heroicons/20/solid/academic-cap.svelte'

<Meta title="Heroicons/Mini" />

# Mini

<IconGallery>
	<IconItem name="academic-cap">
		<AcademicCap />
	</IconItem>
</IconGallery>

日志:

Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot [react-dom.development.js:86:29](http://localhost:6006/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js)
Uncaught TypeError: class constructors must be invoked with 'new'
React 16
render chunk-MA2MUXQN.mjs:1
promise callback*DocsRenderer/this.render chunk-MA2MUXQN.mjs:1
renderDocs runtime.mjs:75
renderDocs runtime.mjs:75
renderToElement runtime.mjs:75
renderSelection runtime.mjs:84
onSetCurrentStory runtime.mjs:84
handleEvent runtime.mjs:5
handleEvent runtime.mjs:5
Channel runtime.mjs:5
handler runtime.mjs:10
handleEvent runtime.mjs:10
PostmsgTransport runtime.mjs:10
createChannel runtime.mjs:10
<anonymous> null:5
[react-dom.development.js:16305:27](http://localhost:6006/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js)
The above error occurred in the <Proxy<Academic-cap>> component:

Proxy<Academic-cap>
div
withEmotionCache/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1449:46
div
withEmotionCache/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1449:46
IconItem@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-U5HOB67C.js?v=10e388c1:2930:16
div
withEmotionCache/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1449:46
div
withEmotionCache/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1449:46
IconGallery@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-U5HOB67C.js?v=10e388c1:2931:19
MDXContent@http://localhost:6006/src/stories/Mini.mdx?t=1673172255195&import:7:50
div
withEmotionCache/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1449:46
div
withEmotionCache/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1449:46
ThemeProvider@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-CJEASUMU.js?v=10e388c1:1475:45
SourceContainer@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-U5HOB67C.js?v=10e388c1:3053:23
DocsContainer@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-U5HOB67C.js?v=10e388c1:3165:21
Docs@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-U5HOB67C.js?v=10e388c1:3314:12
MDXProvider@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-WNDIUHYG.js?v=10e388c1:28:21

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries. [react-dom.development.js:18687:14](http://localhost:6006/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js)
Uncaught (in promise) TypeError: class constructors must be invoked with 'new'
    React 13
    render chunk-MA2MUXQN.mjs:1
    promise callback*DocsRenderer/this.render chunk-MA2MUXQN.mjs:1
    renderDocs runtime.mjs:75
    renderDocs runtime.mjs:75
    renderToElement runtime.mjs:75
    renderSelection runtime.mjs:84
    onSetCurrentStory runtime.mjs:84
    handleEvent runtime.mjs:5
    handleEvent runtime.mjs:5
    Channel runtime.mjs:5
    handler runtime.mjs:10
    handleEvent runtime.mjs:10
    PostmsgTransport runtime.mjs:10
    createChannel runtime.mjs:10
    <anonymous> null:5
[react-dom.development.js:16305:27](http://localhost:6006/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js)

重现步骤

git clone git@github.com:NatoBoram/heroicons.svelte.git
cd heroicons.svelte
pnpm i
pnpm storybook

系统信息

Environment Info:

  System:
    OS: Linux 6.0 Pop!_OS 22.04 LTS
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
  Binaries:
    Node: 19.3.0 - /usr/bin/node
    npm: 9.2.0 - ~/.local/share/pnpm/npm
  Browsers:
    Chrome: 108.0.5359.124
    Firefox: 108.0
  npmPackages:
    @storybook/addon-docs: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/addon-essentials: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/addon-interactions: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/addon-links: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/blocks: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/svelte: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/sveltekit: 7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/testing-library: ^0.0.13 => 0.0.13 
    @storybook/types: 7.0.0-alpha.44 => 7.0.0-alpha.44

其他相关信息

  • 无响应*
ecr0jaav

ecr0jaav1#

文档已移动到 https://storybook.js.org/docs/7.0/svelte/api/doc-block-icongallery

class constructors must be invoked with 'new'

renderWithHooks@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:12171:35
mountIndeterminateComponent@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:14921:21
beginWork@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:15902:22
beginWork$1@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:19749:22
performUnitOfWork@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:19197:20
workLoopSync@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:19133:30
renderRootSync@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:19112:15
recoverFromConcurrentError@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:18732:42
performConcurrentWorkOnRoot@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:18680:30
workLoop@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:197:50
flushWork@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:176:22
performWorkUntilDeadline@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:384:29
EventHandlerNonNull*node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/cjs/scheduler.development.js/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:405:11
node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/cjs/scheduler.development.js@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:453:9
__require2@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-HYZYPRER.js?v=ad72788e:15:50
node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/index.js@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:465:24
__require2@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-HYZYPRER.js?v=ad72788e:15:50
node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js/<@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:481:25
node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:21556:9
__require2@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-HYZYPRER.js?v=ad72788e:15:50
node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/index.js@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-OZU74M3H.js?v=ad72788e:21568:24
__require2@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-HYZYPRER.js?v=ad72788e:15:50
@http://localhost:6006/node_modules/.cache/.vite-storybook/deps/chunk-5XGKJHDW.js?v=ad72788e:31:32

相关问题