Gentman_Dylan 2023-01-30 15:40 采纳率: 50%
浏览 69
已结题

dumi编译运行报错

dumi 编译运行时,会弹出报错,在试了该Github上的解决办法也无效,请问有知道的吗?
报错的问题我也试了是加了红框的代码才报错的,如果注释掉该代码就可以正常运行

img

error - ./src/ZTest/index.md
Module build failed (from ./node_modules/dumi/dist/loaders/markdown/index.js):
Error: invalid type: JsValue(Function(plugin)), expected any value
    at module.exports.__wbindgen_error_new (E:\workspace\zd-ui\node_modules\@swc\wasm\wasm.js:446:17)
    at wasm://wasm/04dc58fa:wasm-function[13010]:0xe41844
    at wasm://wasm/04dc58fa:wasm-function[5753]:0xbe963b
    at wasm://wasm/04dc58fa:wasm-function[2757]:0x9a9d0f
    at wasm://wasm/04dc58fa:wasm-function[234]:0x2bc0b7
    at wasm://wasm/04dc58fa:wasm-function[133]:0x19d55b
    at wasm://wasm/04dc58fa:wasm-function[16191]:0xea27eb
    at Object.module.exports.transformSync (E:\workspace\zd-ui\node_modules\@swc\wasm\wasm.js:333:14)
    at Compiler.transformSync (E:\workspace\zd-ui\node_modules\@swc\core\index.js:248:37)
    at transformSync (E:\workspace\zd-ui\node_modules\@swc\core\index.js:348:21)
    at ReactTechStack.transformCode (E:\workspace\zd-ui\node_modules\dumi\dist\techStacks\react.js:135:54)
    at E:\workspace\zd-ui\node_modules\dumi\dist\loaders\markdown\transformer\rehypeDemo.js:152:37
    at Array.forEach (<anonymous>)
    at E:\workspace\zd-ui\node_modules\dumi\dist\loaders\markdown\transformer\rehypeDemo.js:126:23
    at overload (file:///E:/workspace/zd-ui/node_modules/unist-util-visit/lib/index.js:173:16)
    at node (element<p>) (file:///E:/workspace/zd-ui/node_modules/unist-util-visit-parents/lib/index.js:189:31)
    at node (root) (file:///E:/workspace/zd-ui/node_modules/unist-util-visit-parents/lib/index.js:206:79)
    at visitParents (file:///E:/workspace/zd-ui/node_modules/unist-util-visit-parents/lib/index.js:148:35)
    at visit (file:///E:/workspace/zd-ui/node_modules/unist-util-visit/lib/index.js:165:7)
    at E:\workspace\zd-ui\node_modules\dumi\dist\loaders\markdown\transformer\rehypeDemo.js:122:5
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:115:27)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)
    at done (file:///E:/workspace/zd-ui/node_modules/trough/index.js:148:7)
    at then (file:///E:/workspace/zd-ui/node_modules/trough/index.js:158:5)
    at wrapped (file:///E:/workspace/zd-ui/node_modules/trough/index.js:136:9)
    at next (file:///E:/workspace/zd-ui/node_modules/trough/index.js:65:23)

补充:

img

上方的javascript是可以正常编译的,但是使用jsx或tsx时就会报错

  • 写回答

2条回答 默认 最新

  • CodeBytes 2023-01-30 16:30
    关注

    这是一个错误,表示 dumi 编译运行时出现了错误,具体错误内容为:编译 ./src/ZTest/index.md 文件时,出现了模块构建失败的错误,错误原因为数据类型不正确:期望获得任何数值,但实际上是一个 JsValue(Function(plugin))。

    建议检查 ./src/ZTest/index.md 文件的内容和 dumi 的配置,以确定错误原因并解决问题。

    import React from 'react';
    import ZTest from "zd-ui";
    
    export default () => <ZTest msg="hello" />;
    
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 2月6日
  • 修改了问题 1月30日
  • 创建了问题 1月30日