marko 5.39.15 → 5.39.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,17 +11,27 @@ const loadTagsByFile = new WeakMap();
11
11
  function analyzeLoadImport(importDecl, tagEntry) {
12
12
  if (!importDecl.node.attributes?.length) return;
13
13
 
14
- const loadAttrValuePath = importDecl.
14
+ const loadAttrPath = importDecl.
15
15
  get("attributes").
16
16
  find(
17
17
  (p) =>
18
18
  (p.node.key.type === "Identifier" ?
19
19
  p.node.key.name :
20
20
  p.node.key.value) === "load"
21
- )?.
22
- get("value");
21
+ );
22
+
23
+ if (!loadAttrPath) return;
24
+
25
+ // Under hot reload every module is already eagerly loaded, so the lazy facade
26
+ // buys nothing and its HMR-cached template collides with the real template's
27
+ // `_` slot, recursing on render (see load-tag-browser.js). Drop the attribute
28
+ // so the import compiles as a normal eager tag import in dev.
29
+ if (importDecl.hub.file.markoOpts.hot) {
30
+ loadAttrPath.remove();
31
+ return;
32
+ }
23
33
 
24
- if (!loadAttrValuePath) return;
34
+ const loadAttrValuePath = loadAttrPath.get("value");
25
35
 
26
36
  if (!tagEntry) {
27
37
  throw importDecl.buildCodeFrameError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.39.15",
3
+ "version": "5.39.16",
4
4
  "private": false,
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "keywords": [
@@ -11,17 +11,27 @@ const loadTagsByFile = new WeakMap();
11
11
  export function analyzeLoadImport(importDecl, tagEntry) {
12
12
  if (!importDecl.node.attributes?.length) return;
13
13
 
14
- const loadAttrValuePath = importDecl
14
+ const loadAttrPath = importDecl
15
15
  .get("attributes")
16
16
  .find(
17
17
  (p) =>
18
18
  (p.node.key.type === "Identifier"
19
19
  ? p.node.key.name
20
20
  : p.node.key.value) === "load",
21
- )
22
- ?.get("value");
21
+ );
22
+
23
+ if (!loadAttrPath) return;
24
+
25
+ // Under hot reload every module is already eagerly loaded, so the lazy facade
26
+ // buys nothing and its HMR-cached template collides with the real template's
27
+ // `_` slot, recursing on render (see load-tag-browser.js). Drop the attribute
28
+ // so the import compiles as a normal eager tag import in dev.
29
+ if (importDecl.hub.file.markoOpts.hot) {
30
+ loadAttrPath.remove();
31
+ return;
32
+ }
23
33
 
24
- if (!loadAttrValuePath) return;
34
+ const loadAttrValuePath = loadAttrPath.get("value");
25
35
 
26
36
  if (!tagEntry) {
27
37
  throw importDecl.buildCodeFrameError(