Skip to content

Intellisense won't work with a Nuxt3 project with a .tailwind.config.ts (typescript) file #591

@lucavenir

Description

@lucavenir

What version of Tailwind CSS IntelliSense are you using?

v0.8.6

What version of Tailwind CSS are you using?

I'm using @nuxtjs/tailwindcss v5.3.1, which resolves to v3.1.8

What package manager are you using?

npm

What operating system are you using?

Ubuntu 22.04

Describe your issue

To reproduce, to the following:

  1. Start a new Nuxt3 project (docs)
  2. Install TailwindCSS on it (docs)
  3. Choose to use a tailwind.config.ts file (Typescript) like the following:
import { Config } from "tailwindcss";

export default <Config>{
  content: [
    "./components/**/*.{js,vue,ts}",
    "./layouts/**/*.vue",
    "./pages/**/*.vue",
    "./plugins/**/*.{js,ts}",
  ],
  theme: {},
  plugins: [],
};

TailwindCSS Intellisense outputs the following (extension outputs):

[Error - 6:52:46 PM] Tailwind CSS: No config file found.

Now, simply change the .ts file into a .js file, like so:

// tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./components/**/*.{js,vue,ts}",
    "./layouts/**/*.vue",
    "./pages/**/*.vue",
    "./plugins/**/*.{js,ts}",
  ],
  theme: {},
  plugins: [],
};

And tadah! This works. The extension outputs:

Found Tailwind CSS config file: /home/user/my-project-dir/tailwind.config.js
Loaded postcss v8.4.16: /home/user/my-project-dir/node_modules/postcss
Loaded tailwindcss v3.1.8: /home/user/my-project-dir/node_modules/tailwindcss

This simply means I'll just use a .js file as it changes nothing but this made me lose my mind for a couple of hours, so I'm opening this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions