-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
The Astro 6 does not support subpath imports when used with client components #15922
Copy link
Copy link
Closed
Closed
Copy link
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)Related to the core `astro` package (scope)pkg: cloudflareRelated to the Cloudflare adapterRelated to the Cloudflare adapter
Description
Astro Info
Astro v6.0.4
Vite v7.3.1
Node v24.13.0
System macOS (arm64)
Package Manager pnpm
Output server
Adapter @astrojs/cloudflare (v13.1.1)
Integrations @astrojs/react (v5.0.0)
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
The Astro 6 does not support subpath imports when used with React client components.
I set up subpath imports in package.json and tried using them in the index.astro file as follows:
// package.json
{
"imports": {
"#*": "./src/*"
}
}
// pages/index.astro
import { ButtonA } from "#components/button-a";
<ButtonA client:load />
The component is not responsive to click actions and shows the following error in the browser console:
(index):481 GET http://localhost:4321/@id/ net::ERR_ABORTED 404 (Not Found)
(anonymous) @ (index):481
e @ (index):481
start @ (index):481
childrenConnectedCallback @ (index):481
await in childrenConnectedCallback
e @ (index):481
(anonymous) @ (index):481
installHook.js:1 [astro-island] Error hydrating /@id/#components/button-a TypeError: Failed to fetch dynamically imported module: http://localhost:4321/@id/#components/button-a
overrideMethod @ installHook.js:1
start @ (index):481
await in start
childrenConnectedCallback @ (index):481
await in childrenConnectedCallback
e @ (index):481
(anonymous) @ (index):481
What's the expected result?
Subpath imports should work with the client components and allow interaction as usual.
Link to Minimal Reproducible Example
https://github.com/takeshikriang/astro-6-subpath-issue-report
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P3: minor bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)Related to the core `astro` package (scope)pkg: cloudflareRelated to the Cloudflare adapterRelated to the Cloudflare adapter