大家好,希望你们都做得好,
我试图添加一个插件到理智和插件是sanity-plugin-order-documents 。
我已经一步一步地遵循了文档中显示的所有步骤。
i将
"plugins": [ "order-documents" ],添加到sanity.json中
并添加以下字段:
{ name: "order", title: "Order", type: "number", hidden: true, },
转到sanity\schemas\projects.js
。
这就是我在代码中使用插件的方式:
useEffect(() => {
sanityClient.fetch(
`
*[_type == "projects"] | order(order asc){
...,
}
`
).then((data) => {
setProjectsData(data)
})
}, [])
但是,每当我尝试进行正常启动或正常部署时,都会出现以下错误:
Error: Errors while building:
./node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js
Module parse failed: Unexpected token (307:11)
You may need an appropriate loader to handle this file type.
| }
|
| return { ...rect,
| x: rect.x - scroll.scrollLeft + offsets.x,
| y: rect.y - scroll.scrollTop + offsets.y
@ ./node_modules/react-select/dist/react-select.esm.js 24:0-26
@ ./node_modules/sanity-plugin-order-documents/build/components/organisms/TypeSection.js
@ ./node_modules/sanity-plugin-order-documents/build/components/OrderDocuments.js
@ ./node_modules/sanity-plugin-order-documents/build/index.js
@ ./node_modules/sanity-plugin-order-documents/build?sanityPart=all%3Apart%3A%40sanity%2Fbase%2Ftool
@ ./node_modules/@sanity/default-layout/lib/util/getRegisteredTools.js
@ ./node_modules/@sanity/default-layout/lib/router.js
@ ./node_modules/@sanity/default-layout/lib/Root.js?sanityPart=part%3A%40sanity%2Fbase%2Froot
@ ./node_modules/@sanity/base/lib/components/SanityRoot.js?sanityPart=part%3A%40sanity%2Fbase%2Fsanity-root
@ ./node_modules/@sanity/server/lib/browser/entry.js
@ multi ./node_modules/@sanity/server/lib/browser/entry.js
at buildStaticAssets (C:/Users/Slima/Desktop/abdellah-slimani-portfolio/sanity/node_modules/@sanity/core/lib/actions/build/buildStaticAssets.js:103:13)
at async _default (C:/Users/Slima/Desktop/abdellah-slimani-portfolio/sanity/node_modules/@sanity/core/lib/actions/deploy/deployAction.js:78:9)
我已经做了一些研究来解决这个问题,我看到很多人建议编辑webpack文件,但我不知道该如何添加到该文件。
请派人帮忙,SOS。
发布于 2022-11-30 13:25:04
我刚才碰到了这个问题,在深入调查之后,我觉得理智的v2对react-select@^5不太满意。我看了一下最近升级了react-select@^5的一些智能插件,所有的包都会触发这条错误消息。您应该将以下软件包绑定到react-select小于5的最新版本。
yarn add或npm install
sanity-plugin-autocomplete-tags@1.0.0sanity-plugin-media@1.4.13sanity-plugin-order-documents@0.0.19发布于 2022-11-29 07:46:39
如果您使用的是明智-插件-媒体包,那么您应该更新它的最新版本。这应该能解决你的问题!
发布于 2022-11-30 18:15:50
理智-插件-媒体@1.4.13使用>5.1.4.10作品
https://stackoverflow.com/questions/74606440
复制相似问题