withastro / compiler

The Astro compiler. Written in Go. Distributed as WASM.
Other
502 stars 59 forks source link

🐛 BUG: panic: html: bad parser state: originalIM was set twice [recovered] panic: interface conversion: string is not error: missing method Error #1038

Open lilith opened 3 months ago

lilith commented 3 months ago

What version of @astrojs/compiler are you using?

2.10.1

What package manager are you using?

npm

What operating system are you using?

wsl2

Describe the Bug

`panic: html: bad parser state: originalIM was set twice [recovered]
        panic: interface conversion: string is not error: missing method Error

goroutine 8 [running]:
main.main.Transform.func1.1.1.1()
        ./astro-wasm.go:327 +0x5
panic({0x17900, 0x7b180})
        runtime/panic.go:770 +0x1a
github.com/withastro/compiler/internal.(*parser).setOriginalIM(...)
        github.com/withastro/compiler/internal/parser.go:544
github.com/withastro/compiler/internal.inBodyIM(0x14565a0)
        github.com/withastro/compiler/internal/parser.go:1105 +0x3f8
github.com/withastro/compiler/internal.(*parser).parseCurrentToken(0x14565a0)
        github.com/withastro/compiler/internal/parser.go:2981 +0x12
github.com/withastro/compiler/internal.(*parser).parse(0x14565a0)
        github.com/withastro/compiler/internal/parser.go:3008 +0x3
github.com/withastro/compiler/internal.ParseWithOptions({0x7b9c8, 0x1434260}, {0x14b9e20, 0x1, 0x1})
        github.com/withastro/compiler/internal/parser.go:3072 +0x13
main.main.Transform.func1.1.1()
        ./astro-wasm.go:332 +0x4
created by main.main.Transform.func1.1 in goroutine 6
        ./astro-wasm.go:323 +0x7
exit code: 2
24:09:23 [ERROR] [UnknownCompilerError] Cannot read properties of undefined (reading 'exports')
  Hint:
    This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues/compiler.
  Error reference:
    https://docs.astro.build/en/reference/errors/unknown-compiler-error/
  Stack trace:
    at syscall/js.valueNew (file:///home/lilith/work/imazen-web/node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js:1:4526)
    at wasm://wasm/0138ceae:wasm-function[1567]:0x168b12
    at wasm://wasm/0138ceae:wasm-function[1543]:0x164c04
    at wasm://wasm/0138ceae:wasm-function[1169]:0xfab0e
    [...] See full stack trace in the browser, or rerun with --verbose.`

Link to Minimal Reproducible Example

mailto:lilith@imazen.io

lilith commented 3 months ago

Just forgot the first '---' at the top of the .astro file. Had me panicked for a second

jasikpark commented 3 months ago

Maybe there should be a better error here?