Astro Info
Broken version
Astro v7.0.0
Vite v8.0.16
Node v26.0.0
System macOS (arm64)
Package Manager npm
Output static
Adapter none
Integrations none
#### Working version
```block
Astro v6.4.8
Vite v7.3.5
Node v26.0.0
System macOS (arm64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
Browser-agnostic.
Describe the Bug
Astro 7 doesn't understand tsconfig aliases in <style> (maybe not in CSS altogether, didn't check), where Astro 6.4.8 did.
With a component like
---
---
<html><body>...</body></html>
<style>
body {
background-image: url('@assets/ok.png');
}
</style>
and a tsconfig like
{
"extends": "astro/tsconfigs/strictest",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"exactOptionalPropertyTypes": false,
"jsx": "react-jsx",
"jsxImportSource": "react",
"noImplicitAny": false,
"paths": {
"@assets/*": ["./src/assets/*"],
}
},
"include": [".astro/types.d.ts", "**/*.ts", "**/*.tsx", "**/*.astro"],
"exclude": ["dist", "node_modules"]
}
Astro 6.4.8 (works)
Astro 6.4.8 builds a site with _astro/ok.HASH.png:
13:19:31 [vite] Re-optimizing dependencies because lockfile has changed
13:19:32 [types] Generated 92ms
13:19:32 [build] output: "static"
13:19:32 [build] mode: "static"
13:19:32 [build] directory: /Users/akx/build/astro-import-bug/dist/
13:19:32 [build] Collecting build info...
13:19:32 [build] ✓ Completed in 101ms.
13:19:32 [build] Building static entrypoints...
13:19:32 [vite] ✓ built in 335ms
13:19:32 [vite] ✓ built in 2ms
13:19:32 [build] Rearranging server assets...
13:19:32 ├─ /index.html (+4ms)
13:19:32 ✓ Completed in 11ms.
13:19:32 [build] ✓ Completed in 370ms.
13:19:32 [build] 1 page(s) built in 472ms
13:19:32 [build] Complete!
Astro 7 (no worky, sad)
and Astro 7.0.0 warns about this and doesn't include ok.XXX.png, leaving broken paths in the built HTML. (I'm happy I had set up Lychee to check for broken local assets before deploy.)
13:20:15 [vite] Re-optimizing dependencies because lockfile has changed
13:20:16 [types] Generated 69ms
13:20:16 [build] output: "static"
13:20:16 [build] mode: "static"
13:20:16 [build] directory: /Users/akx/build/astro-import-bug/dist/
13:20:16 [build] Collecting build info...
13:20:16 [build] ✓ Completed in 75ms.
13:20:16 [build] Building static entrypoints...
13:20:16 [WARN] [vite]
@assets/ok.png referenced in @assets/ok.png didn't resolve at build time, it will remain unchanged to be resolved at runtime
13:20:16 [vite] ✓ built in 67ms
13:20:16 [vite] ✓ built in 9ms
13:20:16 [build] Rearranging server assets...
13:20:16 ├─ /index.html (+5ms)
13:20:16 ✓ Completed in 11ms.
13:20:16 [build] ✓ Completed in 104ms.
13:20:16 [build] 1 page(s) built in 181ms
13:20:16 [build] Complete!
What's the expected result?
That aliases work as they did in Astro 6.4.8.
Link to Minimal Reproducible Example
https://github.com/akx/astro-import-bug
Participation
Astro Info
Broken version
If this issue only occurs in one browser, which browser is a problem?
Browser-agnostic.
Describe the Bug
Astro 7 doesn't understand tsconfig aliases in
<style>(maybe not in CSS altogether, didn't check), where Astro 6.4.8 did.With a component like
and a tsconfig like
{ "extends": "astro/tsconfigs/strictest", "compilerOptions": { "allowSyntheticDefaultImports": true, "exactOptionalPropertyTypes": false, "jsx": "react-jsx", "jsxImportSource": "react", "noImplicitAny": false, "paths": { "@assets/*": ["./src/assets/*"], } }, "include": [".astro/types.d.ts", "**/*.ts", "**/*.tsx", "**/*.astro"], "exclude": ["dist", "node_modules"] }Astro 6.4.8 (works)
Astro 6.4.8 builds a site with
_astro/ok.HASH.png:Astro 7 (no worky, sad)
and Astro 7.0.0 warns about this and doesn't include
ok.XXX.png, leaving broken paths in the built HTML. (I'm happy I had set up Lychee to check for broken local assets before deploy.)What's the expected result?
That aliases work as they did in Astro 6.4.8.
Link to Minimal Reproducible Example
https://github.com/akx/astro-import-bug
Participation