lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.88k stars 86 forks source link

`favicon` plugin crashes lume on fresh site #504

Closed 4censord closed 11 months ago

4censord commented 11 months ago

Version

v1.19.3

Platform

Linux (Linux thearch 6.5.9-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 26 Oct 2023 00:52:20 +0000 x86_64 GNU/Linux)

What steps will reproduce the bug?

Create a fresh config using deno run -Ar https://deno.land/x/lume/init.ts. When prompted, enable the favicon plugin.

Run deno task build

lume crashes with the following log:

Task build deno task lume
Task lume echo "import 'lume/cli.ts'" | deno run --unstable -A -
Loading config file file:///tmp/repro/_config.ts

TypeError: Cannot read properties of undefined (reading 'length')
    at passStringToWasm0 (file:///home/[...]/.cache/deno/npm/registry.npmjs.org/svg2png-wasm/1.4.1/dist/index.mjs:77:17)
    at Converter.convert (file:///home/[...]/.cache/deno/npm/registry.npmjs.org/svg2png-wasm/1.4.1/dist/index.mjs:179:20)
    at (file:///home/[...]/.cache/deno/npm/registry.npmjs.org/svg2png-wasm/1.4.1/dist/index.mjs:332:33)
    at svg2png2 (file:///home/[...]/.cache/deno/npm/registry.npmjs.org/svg2png-wasm/1.4.1/dist/index.mjs:330:38)
    at svg2png (file:///home/[...]/.cache/deno/npm/registry.npmjs.org/svg2png-wasm/1.4.1/dist/index.mjs:359:10)
    at getContent (https://deno.land/x/lume@v1.19.3/plugins/favicon.ts:78:22)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async (https://deno.land/x/lume@v1.19.3/plugins/favicon.ts:85:23)
    at async Events.dispatchEvent (https://deno.land/x/lume@v1.19.3/core/events.ts:49:11)

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

A fresh config should not crash.

What do you see instead?

A crash.

Additional information

No response

oscarotero commented 11 months ago

The plugin expects a /favicon.svg file in your source directory and it fails if this file is missing. Probably it should have a more friendly error.