描述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
其他相关信息
- 无响应*
1条答案
按热度按时间ecr0jaav1#
文档已移动到 https://storybook.js.org/docs/7.0/svelte/api/doc-block-icongallery