Skip to content

Cmd+Click on @reference "#theme.css" does not resolve package.json#imports aliases #1560

@DaniGuardiola

Description

@DaniGuardiola

What version of VS Code are you using?

v1.113.0

What version of Tailwind CSS IntelliSense are you using?

v0.14.29

What version of Tailwind CSS are you using?

v4.2.1

What package manager are you using?

npm

What operating system are you using?

macOS

Tailwind CSS Stylesheet (v4) or config file (v3)

@import "tailwindcss";
@reference "#theme.css";

.example {
  color: var(--color-brand);
}

package.json:

{
  "imports": {
    "#theme.css": "./src/theme.css"
  }
}

VS Code settings

{
  "files.associations": {
    "*.css": "tailwindcss",
    "*.scss": "tailwindcss"
  },
  "tailwindCSS.lint.cssConflict": "ignore"
}

There are no workspace-specific VS Code settings in the reproduction repo.

Reproduction URL

https://github.com/DaniGuardiola/tailwind-vscode-reference-imports-repro

Describe your issue

In a Tailwind CSS v4 stylesheet, @reference "#theme.css"; is shown as a clickable link in VS Code.

However, when I Cmd+Click it, VS Code tries to open a literal file named #theme.css and shows an error that the file could not be found, instead of resolving the alias through package.json#imports.

The reproduction repo defines:

{
  "imports": {
    "#theme.css": "./src/theme.css"
  }
}

and the referenced file exists at src/theme.css.

Steps to reproduce:

  1. Open the reproduction repo in VS Code.
  2. Open src/app.css.
  3. Cmd+Click #theme.css in @reference "#theme.css";.

Expected behavior:

  • The alias resolves through package.json#imports.
  • VS Code opens src/theme.css.

Actual behavior:

  • The reference appears clickable.
  • Cmd+Click fails because VS Code appears to treat #theme.css as a literal file path instead of a package import alias.
Image

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