小编Ben*_*Dev的帖子

“您可能需要一个额外的加载器来处理这些加载器的结果。”

我目前正在尝试为 ReactJs 构建一个状态管理库。但是一旦我将它实现到我的 React 项目(使用create-react-app)中,它就会开始删除这个错误:

Failed to compile.

path/to/agile/dist/runtime.js 116:104
Module parse failed: Unexpected token (116:104)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|       if (subscriptionContainer instanceof sub_1.CallbackContainer) subscriptionContainer.callback(); // If Component based subscription call the updateMethod which every framework has to define
|
>       if (subscriptionContainer instanceof sub_1.ComponentContainer) if (this.agileInstance.integration?.updateMethod) this.agileInstance.integration?.updateMethod(subscriptionContainer.component, Runtime.formatChangedPropKeys(subscriptionContainer));
|     }); // Log Job
|
Run Code Online (Sandbox Code Playgroud)

如果我注释掉错误中提到的突出显示的代码行,它会跳转到另一个点并在那里抱怨。但这不可能是语法错误,因为 TypeScript 也会在 IDE 中抱怨。 …

javascript typescript reactjs webpack

15
推荐指数
4
解决办法
3万
查看次数

(Codesandbox,Vue)“属性或方法“children”未在实例上定义,但在渲染期间引用。”

我目前正在构建一个状态管理器,它可以集成到多个前端框架中,包括 Vue。为了演示 Vue 中状态管理器的用法,我创建了一个简单的codesandbox。因为有一个实时代码示例总是很好,可以在自述文件中进行推广。但不知何故,我总是在代码和框中收到此错误(见下文)。

[Vue warn]: Property or method "children" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
Run Code Online (Sandbox Code Playgroud)

上述错误发生在显示editor + preview. 在本地或在单独的选项卡(仅显示 )中,preview它按预期工作(没有错误)。

Codesandbox(错误):
https://codesandbox.io/s/agilets-first-state-i5xxs ?file=/src/main.js

Codesandbox 单独点击预览(无错误):
https://i5xxs.csb.app/

本地项目(无错误):
https://github.com/agile-ts/agile/tree/master/examples/vue/develop/my-project

我不知道我做错了什么。但这与我的状态管理器有关,因为默认的vue Codesandbox工作正常。

javascript state-management vue.js vuejs2 codesandbox

3
推荐指数
1
解决办法
1017
查看次数