eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

syntax.split is not a function

Open zachleat opened this issue 2 years ago • 2 comments

Build-time error (not runtime):

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering liquid template ./src/tests/liquid-md.md (via TemplateContentRenderError)
[11ty] 2. syntax.split is not a function, file:./src/tests/liquid-md.md, line:8, col:35 (via RenderError)
[11ty] 3. syntax.split is not a function (via TypeError)
[11ty] 
[11ty] Original error stack trace: TypeError: syntax.split is not a function
[11ty]     at Object.renderAsLiquid (/Users/zachleat/Code/demo-eleventy-edge/node_modules/@11ty/eleventy/src/Plugins/EdgePlugin.js:119:26)
[11ty]     at Object.render (/Users/zachleat/Code/demo-eleventy-edge/node_modules/@11ty/eleventy/src/Plugins/Edge/LiquidEdge.js:43:23)
[11ty]     at Tag.<anonymous> (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:4454:47)
[11ty]     at step (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:88:23)
[11ty]     at Object.next (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:69:53)
[11ty]     at /Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:1599:38
[11ty]     at step (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:88:23)
[11ty]     at Object.next (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:69:53)
[11ty]     at fulfilled (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:59:58)
[11ty] Copied 5 files / Wrote 0 files in 0.31 seconds (v2.0.0-canary.15)

Pinned this down to a regression in liquidjs 9.42.0, canary-16 will be pinned to 9.41.0.

To workaround this locally, just add "liquidjs": "9.41.0", to your package.json under dependencies.

zachleat avatar Sep 22 '22 16:09 zachleat

cc @harttle I was able to narrow this down to an extra token being returned here (which resulted in extra internal-to-liquid arguments):

https://github.com/11ty/eleventy/blob/e9ca971210fa06efd2af3a7931ef368dcb085a79/src/Plugins/Edge/LiquidEdge.js#L13-L19

zachleat avatar Sep 22 '22 16:09 zachleat

Specifically this was being returned as a token when I don’t think it should be?

{
    next: [Function (anonymous)],
    throw: [Function (anonymous)],
    return: [Function (anonymous)],
    [Symbol(Symbol.iterator)]: [Function (anonymous)]
  }

zachleat avatar Sep 22 '22 16:09 zachleat

2.0.0-canary.16 has shipped with liquidjs pinned to 9.41.0

zachleat avatar Sep 23 '22 17:09 zachleat

Specifically this was being returned as a token when I don’t think it should be?

No, it shouldn't. I can't see how it can be. Do you have a tagToken.args value (used to init the Tokenizer) to repro? Maybe it's broken elsewhere, it'll help if we have a runable snippet.

https://github.com/11ty/eleventy/blob/e9ca971210fa06efd2af3a7931ef368dcb085a79/src/Plugins/Edge/LiquidEdge.js#L11-L19

harttle avatar Sep 25 '22 07:09 harttle

I got this fixed up! I wasn’t evaluating my tokens correctly in the render function.

zachleat avatar Dec 06 '22 22:12 zachleat

Shipping with 2.0.0-canary.19

zachleat avatar Dec 06 '22 22:12 zachleat