11ty / eleventy-plugin-webc

Adds support for WebC *.webc files to Eleventy
https://www.11ty.dev/docs/languages/webc/
120 stars 10 forks source link

Error when using `bun` #96

Open rrrnld opened 8 months ago

rrrnld commented 8 months ago

I know that bun support isn't mentioned anywhere on the 11ty website or in this plugin's docs, but it went surprisingly well until I hit this error:

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing to "_site/index.html" from "./index.md" (via EleventyTemplateError)
[11ty] 2. Check the dynamic attribute: `@raw="content"`.
[11ty] Original error message: Can't find variable: content (via Error)
[11ty] 
[11ty] Original error stack trace: Error: Check the dynamic attribute: `@raw="content"`.
[11ty] Original error message: Can't find variable: content
[11ty]     at <anonymous> (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/moduleScript.cjs:70:22)
[11ty]     at evaluateScript (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/moduleScript.cjs:32:37)
[11ty]     at evaluateScriptInline (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/moduleScript.cjs:29:43)
[11ty]     at <anonymous> (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/ast.js:426:311)
[11ty]     at evaluateAttribute (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/ast.js:425:29)
[11ty]     at <anonymous> (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/ast.js:444:47)
[11ty]     at getPropContentAst (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/ast.js:429:29)
[11ty]     at <anonymous> (/home/arne/dev/moi/compost.party/ursula/node_modules/@11ty/webc/src/ast.js:620:124)
[11ty]     at processTicksAndRejections (:12:39)
[11ty] Wrote 0 files (skipped 1) in 0.02 seconds (v3.0.0-alpha.5)

index.md is a simple markdown file:

# Hello world

_include/page.webc looks like this (following the docs):

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>WebC Example</title>
    </head>
    <body @raw="content"></body>
</html>

I'm not sure this is something that needs attention, I just wanted to mention it in case someone runs into the same error. Switching to node 18 fixed it. Thanks!

$ bun --version
1.0.24
$ node --version
v18.19.0
$ cat package.json
{
  "type": "module",
  "dependencies": {
    "@11ty/eleventy": "3.0.0-alpha.5",
    "@11ty/eleventy-plugin-webc": "^0.11.2"
  }
}