Vite + Vue: Module @tailwindcss/vite
Not Found in Existing Project
#16250
Replies: 21 comments 46 replies
-
@manjindersarkaria I did the exact same thing yesterday and it worked. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Has anyone been able to fix this? |
Beta Was this translation helpful? Give feedback.
-
I'm also facing the issue. I added a |
Beta Was this translation helpful? Give feedback.
-
I was able to fix by doing a |
Beta Was this translation helpful? Give feedback.
-
Hey folks! If someone could put together a GitHub repo with a minimal Vite setup that reproduces this issue that would be great! |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue with the following tsconfig.json: {
"compilerOptions": {
"lib": ["ESNext"],
"module": "ESNext",
"target": "ESNext",
"types": ["node"],
"moduleResolution": "Node",
"useDefineForClassFields": true,
"jsx": "preserve",
"isolatedModules": true,
"skipLibCheck": true,
"noEmit": true
}
} It seems that it gets fixed by adding the "types": "./dist/index.d.mts",
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
}
}, Also an unlisted video that shows the problem: https://www.youtube.com/watch?v=QqRR7wz6RcY |
Beta Was this translation helpful? Give feedback.
-
moduleResolution: “Node” does not resolve `mts` files. Change to `bundler`.
|
Beta Was this translation helpful? Give feedback.
-
having a similar issue after upgrading from tailwind 3 to 4 using pnpm. my tsconfig.json
my tsconfig.node.json
|
Beta Was this translation helpful? Give feedback.
-
I think the team that built this package had a problem with ts or the configuration of the package, so that the type file of tailwind is not recognized, hopefully it can be solved. |
Beta Was this translation helpful? Give feedback.
-
Try to use PostCSS Instead of Vite. This method helped me in my Electron + Vue + TS + TailwindCSS project |
Beta Was this translation helpful? Give feedback.
-
Rename vite.config.js to vite.config.mjs |
Beta Was this translation helpful? Give feedback.
-
the same, I can only return to 3. x |
Beta Was this translation helpful? Give feedback.
-
Just copy paste this whole code for @tailwind/vite/package.json: {
"name": "@tailwindcss/vite",
"version": "4.0.17",
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/tailwindlabs/tailwindcss.git",
"directory": "packages/@tailwindcss-vite"
},
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
"homepage": "https://tailwindcss.com",
"files": [
"dist/"
],
"publishConfig": {
"provenance": true,
"access": "public"
},
"types": "./dist/index.d.mts",
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
}
},
"dependencies": {
"lightningcss": "1.29.2",
"@tailwindcss/node": "4.0.17",
"@tailwindcss/oxide": "4.0.17",
"tailwindcss": "4.0.17"
},
"devDependencies": {
"@types/node": "^20.14.8",
"vite": "^6.0.0"
},
"peerDependencies": {
"vite": "^5.2.0 || ^6"
},
"scripts": {
"build": "tsup-node",
"dev": "pnpm run build -- --watch"
}
} |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
same issue. No one suggested options resolve this vite: 5.3.2 |
Beta Was this translation helpful? Give feedback.
-
同样的问题,请问如何解决 vite+vue3+ts +tailiwindcss:^4.1.4 |
Beta Was this translation helpful? Give feedback.
-
My project environment Electron forge + TypeScript + tailwind4 I found that the problem can be solved by changing vite.config.js to vite.config.mjs , and modify forge.config.ts |
Beta Was this translation helpful? Give feedback.
-
When will this issue get fixed? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
For me, the error is emitted from my lsp(typescript-language-server), and my tsconfig.json was not set up as an 'include' file under compilerOptions. Adding the vite config file solved it:
In my package.json, type is set to 'module'. However, I'm not sure why the rest of the imports in my vite config file do not seem to have an issue without applying this change. For example, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is anyone facing issues with Vite? I installed
@tailwindcss/vite
as a dependency following the documentation. Then, invite.config.ts
, I added the import:However, I’m getting an error saying that the module
@tailwindcss/vite
could not be found. Has anyone encountered this issue before or found a solution?Beta Was this translation helpful? Give feedback.
All reactions