首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:生成时出错:./node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js模块解析失败:意外令牌(307:11)

错误:生成时出错:./node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js模块解析失败:意外令牌(307:11)
EN

Stack Overflow用户
提问于 2022-11-28 21:03:17
回答 3查看 90关注 0票数 0

大家好,希望你们都做得好,

我试图添加一个插件到理智和插件是sanity-plugin-order-documents

我已经一步一步地遵循了文档中显示的所有步骤。

i将"plugins": [ "order-documents" ],添加到sanity.json

并添加以下字段:

{ name: "order", title: "Order", type: "number", hidden: true, },

转到sanity\schemas\projects.js

这就是我在代码中使用插件的方式:

代码语言:javascript
复制
useEffect(() => {
    sanityClient.fetch(
      `
        *[_type == "projects"] | order(order asc){
        ...,
        }
      `
    ).then((data) => {
      setProjectsData(data)
    })
    
  }, [])

但是,每当我尝试进行正常启动或正常部署时,都会出现以下错误:

代码语言:javascript
复制
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

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2022-11-30 13:25:04

我刚才碰到了这个问题,在深入调查之后,我觉得理智的v2对react-select@^5不太满意。我看了一下最近升级了react-select@^5的一些智能插件,所有的包都会触发这条错误消息。您应该将以下软件包绑定到react-select小于5的最新版本。

yarn addnpm install

  • sanity-plugin-autocomplete-tags@1.0.0
  • sanity-plugin-media@1.4.13
  • sanity-plugin-order-documents@0.0.19
票数 1
EN

Stack Overflow用户

发布于 2022-11-29 07:46:39

如果您使用的是明智-插件-媒体包,那么您应该更新它的最新版本。这应该能解决你的问题!

票数 3
EN

Stack Overflow用户

发布于 2022-11-30 18:15:50

理智-插件-媒体@1.4.13使用>5.1.4.10作品

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74606440

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档