lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

🐛 BUG: `@astrojs/compiler` panic

Open garfieldnate opened this issue 3 years ago • 2 comments

What version of astro are you using?

1.0.0-beta.73

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

@astrojs/compiler encountered an unrecoverable error when compiling the following file.

src/layouts/Home.astro

---
import Basic from "./Basic.astro";
import BaseHead from "../components/BaseHead.astro";
import Header from "../components/Header.astro";

import config from "../config.json";

let { title, description } = config;
---

<Basic content={{title, description}}/>

<html>

<head>
    <BaseHead title={title} description={description} />
</head>

    <body>
        <Header />
        <div class="wrapper">
            <main class="content">
                <section class="intro">
                    <h1>{title}</h1>
                    <p>{description}</p>
                </section>
                <section>
                    <slot/>
                </section>
            </main>
        </div>
    </body>

</html>

<style>
    .content {
        margin-bottom: 8rem;
        margin-top: 4rem;
    }

    .content :global(h2) {
        margin-top: 4rem;
    }

    .intro {
        padding-bottom: 4rem;
        margin-bottom: 2rem;
        border-bottom: 4px solid var(--theme-divider);
    }

    h1 {
        font-size: 2.5rem;
        font-weight: 700;
    }
</style>

Link to Minimal Reproducible Example

none

Participation

  • [ ] I am willing to submit a pull request for this issue.

garfieldnate avatar Jul 21 '22 22:07 garfieldnate

Thanks for opening an issue! I think the problem might be the <Basic content={{title, description}}/> above the html? I'll definitely take a look at how we can fix this, though!

natemoo-re avatar Jul 22 '22 15:07 natemoo-re

This panic occurred while I was still working on the component, and my final version was this (stupidly-simple) component:

---
import Base from "./Base.astro";
import config from "../config.json";

let { title, description } = config;
---

<Base content={{title, description}}>
    <slot/>
</Base>

This component works fine for me, so I don't think the issue was with the {title, description} syntax.

garfieldnate avatar Jul 22 '22 16:07 garfieldnate