Skip to content

Commit 4332d46

Browse files
committed
fix: storybook
1 parent 5a89ae8 commit 4332d46

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.storybook/main.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { StorybookConfig } from '@storybook/react-vite'
2+
import path from 'path'
23

34
const config: StorybookConfig = {
45
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
@@ -18,8 +19,17 @@ const config: StorybookConfig = {
1819
},
1920
async viteFinal(config) {
2021
const { mergeConfig } = await import('vite')
22+
const { resolve } = await import('path')
23+
const { fileURLToPath } = await import('url')
24+
const __filename = fileURLToPath(import.meta.url)
25+
const __dirname = path.dirname(__filename)
2126

2227
return mergeConfig(config, {
28+
resolve: {
29+
alias: {
30+
'@': resolve(__dirname, '../src'),
31+
},
32+
},
2333
optimizeDeps: {
2434
// https://github.com/storybookjs/storybook/issues/28542#issuecomment-2268031095
2535
exclude: [

src/components/CodePlayground/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
SelectValue,
1818
} from '../Select'
1919
import { prettyLanguageName, SupportedLanguage } from '../../types'
20-
import '@/styles/codeSyntax.css'
20+
import '../../styles/codeSyntax.css'
2121
import { motion } from 'motion/react'
2222
import { cn } from '../../lib/utils'
2323
import { AnimatePresence } from 'motion/react'

src/components/CodeSnippet/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useCallback, useState, useEffect, useRef } from 'react'
22
import { cn } from '../../lib/utils'
33
import { ProgrammingLanguage, Size } from '../../types'
44
import { AnimatePresence, motion } from 'motion/react'
5-
import '@/styles/codeSyntax.css'
5+
import '../../styles/codeSyntax.css'
66
import './codeSnippet.css'
77
import { Icon } from '../Icon'
88
import {

src/components/Logo/Animated.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import {
88
} from '@rive-app/react-canvas-lite'
99
import { cva } from 'class-variance-authority'
1010
import { FC, useEffect, useState } from 'react'
11-
12-
// read rive file from local directory into arraybuffer
13-
const riveFile = await import('./speakeasy-logo.riv')
11+
import riveFileUrl from './speakeasy-logo.riv'
1412

1513
const stackLogoClass = cva('relative', {
1614
variants: {
@@ -54,7 +52,7 @@ export const AnimatedLogo = ({
5452
const theme = useTheme()
5553
const [stateMachine, setStateMachine] = useState<StateMachine>('loop-dark')
5654
const { rive, RiveComponent } = useRive({
57-
src: riveFile.default,
55+
src: riveFileUrl,
5856
stateMachines: stateMachine,
5957
autoplay: true,
6058
layout: new Layout({

0 commit comments

Comments
 (0)