Open blackcater opened 5 months ago
const config: StorybookConfig = {
stories: [/** stories */],
addons: [/** addons */],
framework: {
name: '@storybook/react-vite',
options: {},
},
viteFinal: async (config) => {
config.plugins = config.plugins || []
config.plugins.push((await import('@tailwindcss/vite')).default())
return config
},
}
export default config
Everything works fine.
Maybe @tailwindcss/vite
's package.json
should more standard.
{
"main": "./dist/index.js", // CommonJS
"module": "./dist/index.mjs", // ESM
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs",
"default": "./dist/index.js",
},
"./package.json": "./package.json"
},
}
What version of Node are you using? main
and module
are not required in Node as long as you have exports
defined.
What version of Node are you using?
main
andmodule
are not required in Node as long as you haveexports
defined.
node --version
v20.11.0
And the version of storybook
is v8.0.0
.
@blackcater Could you share a repo with a reproduction?
I got the same error when using this package with bun
and vite
. I thought it was a bun
thing, but Jarred replied back:
The error is correct, “vite” is not there in exports. So I think it’s a tailwind thing.
Error:
ERR_PACKAGE_PATH_NOT_EXPORTED No "exports" main defined in @tailwindcss/vite/package.json
~I think this is the only post I found that mentions Storybook for v4, I am not able to get it working, can you share your setup?~
nvm got it working without much hassle
The error is correct, “vite” is not there in exports. So I think it’s a tailwind thing.
@rostero1 Unfortunately this seems like an incorrectly articulated statement, as if he was expecting vite
to be an export of tailwindcss
as opposed to @tailwindcss/vite
Don't know if he checked the right thing but said the wrong thing, or actually checked the wrong thing.
When I use
@tailwindcss/vite
@4 withstorybook
. It reported an error as bellow:It seems like
esbuild
can't findmain
field inpackage.json
from@tailwindcss/vite
package.