Cannot read property ‘fragment’ of undefined


I’m trying to nest one svelte component in another svelte component.

import Parent from './Parent.svelte';

new Parent({
  target: document.querySelector('main')

// Parent.svelte
  import Child from "./Child.svelte";

<p>parent component</p>
<Child />

// Child.svelte
<p>child component</p>

I expect Child.svelte to be nested in Parent.svelte, but I get this error message instead

Cannot read property 'fragment' of undefined

by the way: I´m using parcel with parcel-plugin-svelte


This is a known bug with parcel-svelte-plugin. The workaround for now as per github issue #55 is to disable parcel hmr:

parcel --no-hmr
Leave a Reply

Your email address will not be published. Required fields are marked *