Open
Description
What version of Tailwind CSS are you using?
4.0.7
What build tool (or framework if it abstracts the build tool) are you using?
Storybook Vite (8.5.8)
What version of Node.js are you using?
v22.12.0
What browser are you using?
N/A
What operating system are you using?
macOS
Describe your issue
Tried to integrate the Vite plugin with tailwind V4 in Storybook Vite (8.5.8) and hit this error:
SB_CORE-SERVER_0007 (MainFileEvaluationError): Storybook couldn't evaluate your .storybook/main.ts file.
Original error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/marcuswood/moonshot/platform/node_modules/@tailwindcss/vite/package.json
at exportsNotFound (node:internal/modules/esm/resolve:314:10)
at packageExportsResolve (node:internal/modules/esm/resolve:605:13)
at resolveExports (node:internal/modules/cjs/loader:640:36)
Storybook config
import { StorybookConfig } from '@storybook/react-vite';
import tailwindcss from '@tailwindcss/vite';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['@storybook/addon-essentials'],
framework: '@storybook/react-vite',
staticDirs: ['./public'],
viteFinal: (config) => {
config.plugins?.push(tailwindcss());
return config;
},
core: {
builder: '@storybook/builder-vite',
},
};
export default config;
If I add this patch, everything works no problem:
diff --git a/package.json b/package.json
index b2ec5209a1ffc89586176fb2c1fec2f0577112a2..c906c6bf8025ab5cf59b63cfdf4443117b96c62e 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,8 @@
"exports": {
".": {
"types": "./dist/index.d.mts",
- "import": "./dist/index.mjs"
+ "import": "./dist/index.mjs",
+ "default": "./dist/index.mjs"
}
},
"dependencies": {
Not sure why this is needed, I keep getting mixed up on the ESM stuff. Looks pretty harmless to add? Filing the issue in case other people run into it!
Metadata
Metadata
Assignees
Labels
No labels