Skip to content

Commit 7836999

Browse files
committed
recreate component when deps have changed, even if component code hasn't
1 parent c3b9863 commit 7836999

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

runtime/hot-api.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,20 @@ function applyHmr(args) {
138138
})
139139

140140
if (canAccept) {
141-
hot.accept(async () => {
141+
hot.accept(async ({ hasChangedDeps }) => {
142142
const newCssId = r.current.cssId
143143
const cssChanged = newCssId !== cssId
144144
// ensure old style sheet has been removed by now
145145
if (cssChanged) removeStylesheet(cssId)
146146
// guard: css only change
147-
if (r.current.cssOnly && (!cssChanged || replaceCss(cssId, newCssId))) {
147+
if (
148+
// NOTE hasChangedDeps is provided only by rollup-plugin-hot, and we
149+
// can't safely assume a CSS only change without it... this means we
150+
// can't support CSS only injection with Nollup or Webpack currently
151+
hasChangedDeps === false && // WARNING check false, not falsy!
152+
r.current.cssOnly &&
153+
(!cssChanged || replaceCss(cssId, newCssId))
154+
) {
148155
return
149156
}
150157

0 commit comments

Comments
 (0)