Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义组件在物料工程导入react-grid-layout组件,运行报错 #3003

Open
xiaotaylor opened this issue Apr 19, 2024 · 0 comments

Comments

@xiaotaylor
Copy link

xiaotaylor commented Apr 19, 2024

我想自定义布局,在物料工程导入react-grid-layout组件,运行报错。
这个错误信息是 Webpack 在编译项目时产生的,指出在处理 ./node_modules/react-grid-layout/build/utils.js 和 ./node_modules/react-grid-layout/build/ReactGridLayout.js 这两个模块文件时遇到了未预期的语法(Unexpected token),从而导致模块解析失败。具体来说,Webpack 遇到了它当前配置下无法识别或转换的 ECMAScript 语法特性。

在提供的代码片段中,Webpack 对于“可选链操作符”(?.) 这一ES2020新特性似乎没有正确处理,因为没有合适的加载器来转换这种语法以使其能够在不支持该特性的浏览器或环境中运行。
image

然后我尝试配置babel 的@babel/plugin-proposal-optional-chaining插件好像都不可行,在物料工程怎么配置babel插件呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant