[英]Cannot read property 'fragment' of undefined
I'm trying to nest one svelte component in another svelte component.我试图将一个苗条的组件嵌套在另一个苗条的组件中。
//index.js
import Parent from './Parent.svelte';
new Parent({
target: document.querySelector('main')
})
// Parent.svelte
<script>
import Child from "./Child.svelte";
</script>
<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我希望 Child.svelte 嵌套在 Parent.svelte 中,但我收到此错误消息
Cannot read property 'fragment' of undefined
by the way: I´m using parcel with parcel-plugin-svelte顺便说一句:我正在使用带有parcel-plugin-svelte的parcel
This is a known bug with parcel-svelte-plugin
.这是
parcel-svelte-plugin
一个已知错误。 The workaround for now as per github issue #55 is to disable parcel hmr
:现在根据github 问题 #55的解决方法是禁用包裹
hmr
:
parcel --no-hmr
I had a similar issue and need to change the way how react is imported我有一个类似的问题,需要改变 react 的导入方式
import { React } from 'react'
need to change to需要更改为
import React from 'react'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.