From 1fad4d2495df96729336b62c2f510789200a0ee4 Mon Sep 17 00:00:00 2001 From: Jake Laderman Date: Tue, 26 Nov 2024 00:30:10 -0600 Subject: [PATCH] fix storybook --- package.json | 6 +++--- vite.config.ts | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index feed2f4d..7e4e9c35 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,11 @@ ], "scripts": { "start": "storybook dev -p 6006", - "build:storybook": "yarn clean && storybook build && yarn build:fix:storybook", + "build:storybook": "yarn build && storybook build && yarn build:fix:storybook", "build:fix:storybook": "perl -pi -w -e 's/%40/@/g;' storybook-static/index.html", "storybook:serve-static": "yarn build:storybook && http-server storybook-static", - "build": "tsc --noEmit && vite build", - "build:watch": "vite build --watch", + "build": "rimraf dist && tsc --noEmit && vite build", + "build:watch": "rimraf dist && vite build --watch", "clean": "rimraf storybook-static dist", "test": "vitest --run", "test:watch": "vitest", diff --git a/vite.config.ts b/vite.config.ts index a3c728ff..5d5741d5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,9 +7,9 @@ import dts from 'vite-plugin-dts' export default defineConfig({ build: { lib: { - entry: { index: resolve(__dirname, 'src/index.ts') }, + entry: resolve(__dirname, 'src/index.ts'), formats: ['es', 'cjs'], - fileName: (format, entryName) => `${entryName}.${format}.js`, + fileName: (format) => `index.${format}.js`, }, rollupOptions: { external: [ @@ -38,7 +38,12 @@ export default defineConfig({ }), dts({ insertTypesEntry: true, - rollupTypes: true, + include: ['src'], + exclude: ['**/*.stories.tsx', '**/*.test.tsx'], + beforeWriteFile: (filePath, content) => ({ + filePath: filePath.replace(/src/, 'dist'), + content, + }), }), ], optimizeDeps: {