Skip to content

The <style> tag is not compiled when the component is imported by "paths" #15963

@Roffild

Description

@Roffild

Astro Info

Astro                    v6.0.5
Node                     v25.7.0
System                   Windows (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

tsconfig.json

{
  "compilerOptions": {
    "paths": {
      "@/*": ["./src/*"]
    }
  }
} 

When a component is imported with @

import Test from '@/components/test.astro';
[astro:build] Could not load ./src/components/test.astro?astro&type=style&index=0&lang.css (imported by src/components/test.astro): 
No cached compile metadata found for "./src/components/test.astro?astro&type=style&index=0&lang.css". 
The main Astro module "./src/components/test.astro" should have compiled and filled the metadata first, before its virtual modules can be requested.
  Stack trace:
at Object.handler (file:///./node_modules/astro/dist/vite-plugin-astro/index.js:115:19)
    at file:///./node_modules/astro/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:22571:40
    at async file:///./node_modules/astro/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:21445:33

There is no error when the component is imported using a relative path.

import Test from '../components/test.astro';

stylebug.zip

What's the expected result?

No error

Link to Minimal Reproducible Example

file

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions