Skip to content

The Astro 6 does not support subpath imports when used with client components #15922

@takeshikriang

Description

@takeshikriang

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)pkg: cloudflareRelated to the Cloudflare adapter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions