Skip to content

🐛 BUG: <Markdown content={content}> causes parse error #1259

@lhermann

Description

@lhermann

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

I am on astro@0.20.3

Using the markdown component works when used like this:

<Markdown>
  # Foo
</Markdown>

But it causes a parse error when used like in this .astro file:

---
import { Markdown } from 'astro/components';
const content = "# Foo";
---

<Markdown content={content} />

Error message:

[23:50:59] [snowpack] Build Result Error: There was a problem with a file build result.
[executing astro] Error: Parse error @:1:1
    at parse (/client/node_modules/snowpack/node_modules/es-module-lexer/dist/lexer.cjs:1:402)
    at scanCodeImportsExports (/client/node_modules/snowpack/lib/cjs/rewrite-imports.js:21:29)
    at transformEsmImports (/client/node_modules/snowpack/lib/cjs/rewrite-imports.js:37:27)
    at Object.transformFileImports (/client/node_modules/snowpack/lib/cjs/rewrite-imports.js:108:16)
    at FileBuilder.resolveImports (/client/node_modules/snowpack/lib/cjs/build/file-builder.js:116:48)
    at async Object.loadUrl (/client/node_modules/snowpack/lib/cjs/commands/dev.js:641:39)
    at async load (/client/node_modules/snowpack/lib/cjs/commands/dev.js:217:28)
    at async /client/node_modules/snowpack/lib/cjs/ssr-loader/index.js:60:28
    at async Object.importModule (/client/node_modules/snowpack/lib/cjs/ssr-loader/index.js:165:26)
    at async load (file:///path/to/client/node_modules/astro/dist/runtime.js:93:17)
    at async Server.<anonymous> (file:///path/to/client/node_modules/astro/dist/dev.js:21:20) {
  idx: 0
}

Steps to Reproduce

  1. Use basic astro template
  2. Create .astro file in /src/pages as described in this report
  3. Try to open the page

Link to Minimal Reproducible Example (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions