Skip to content

V6 Regression - HMR broken when for dynamic imports #16522

@veesahni

Description

@veesahni

Astro Info

Astro                    v6.1.10
Vite                     v7.3.2
Node                     v24.15.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

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

No response

Describe the Bug

Given ./content/one.astro:

---
---

<div>TEST</div>

In Astro 5.18.1, all three patterns below trigger HMR on save of one.astro.
In Astro 6.1.10, only the first does. Furthermore, manual refresh also doesn't work in 6.1.10, it seems to be serving a cached result.

Pattern 1: static import used directly in template. Works on 5.18.1 and 6.1.10

---
import Content from './content/one.astro'
export function getStaticPaths() {
  return [{ params: { slug: 'one' } }]
}
---

<Content />

Pattern 2: static import passed as a prop via getStaticPaths. Works on 5.18.1, does NOT work on 6.1.10

---
import OneContent from './content/one.astro'

export function getStaticPaths() {
  return [{ params: { slug: 'one' }, props: { Content: OneContent } }]
}

const { Content } = Astro.props
---

<Content />

Pattern 3: dynamic import resolved at request time. Works on 5.18.1, does NOT work on 6.1.10

---
export function getStaticPaths() {
  return [{ params: { slug: 'one' } }, { params: { slug: 'two' } }]
}
const { slug } = Astro.params
const { default: Content } = await import(`./content/${slug}.astro`)
---

<Content />

This all may be related to #16342, #16000, #15983

What's the expected result?

Dynamic imports should work in Astro 6 as they previously worked in Astro 5.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-rnnrmrdl?file=src%2Fpages%2Fcontent%2Fone.astro

Participation

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

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)fix pending verificationReporter needs to verify the triage bot fix workspkg: astroRelated to the core `astro` package (scope)

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