Skip to content

@tailwindcss/vite v4.1.18 is not compatible with astro v5 aliases #19677

@4ndv

Description

@4ndv

What version of Tailwind CSS are you using?

v.4.1.18

What build tool (or framework if it abstracts the build tool) are you using?

Astro 5.17.2

What version of Node.js are you using?

v22.22.0

What browser are you using?

N/A

What operating system are you using?

macOS

Reproduction URL

https://github.com/4ndv/astro-tailwind-issue-repro

Describe your issue

After upgrading @tailwindcss/vite to 4.1.18, import aliases breaks inside of astro's <style> blocks:

<style>
  @reference '@styles/global.css';

  header {
    @apply py-8;
  }
</style>
22:50:54 [ERROR] Can't resolve '@styles/global.css' in '/Users/lynx/projects/astro-tailwind-imports/src/pages'
  Stack trace:
    at /Users/lynx/projects/astro-tailwind-imports/src/pages/index.astro?astro&type=style&index=0&lang.css
    [...] See full stack trace in the browser, or rerun with --verbose.

The most likely cause is #18970, astro v5 uses version of Vite where environment API is present, but internally astro still overrides config.createResolver

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