umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.38k stars 2.65k forks source link

添加区块,变量名报错,This experimental syntax requires enabling the parser plugin: 'optionalChaining' (169:24) #5327

Closed cumtb1909 closed 4 years ago

cumtb1909 commented 4 years ago

SyntaxError: This experimental syntax requires enabling the parser plugin: 'optionalChaining' (169:24) at Object.raise (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:6344:17) at Object.expectPlugin (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:7664:18) at Object.parseSubscript (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8448:12) at Object.parseSubscript (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:5288:18) at Object.parseSubscripts (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8434:19) at Object.parseExprSubscripts (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8423:17) at Object.parseMaybeUnary (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8393:21) at Object.parseMaybeUnary (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:5668:20) at Object.parseExprOps (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8280:23) at Object.parseMaybeConditional (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8253:23) at Object.parseMaybeAssign (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8200:21) at Object.parseMaybeAssign (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:5628:20) at Object.parseExpression (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:8148:23) at Object.jsxParseExpressionContainer (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:3450:30) at Object.jsxParseElementAt (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:3544:36) at Object.jsxParseElement (E:\Code\antetc\antetc\node_modules\@umijs\block-sdk\node_modules\@babel\parser\lib\index.js:3587:17) { pos: 4282, loc: Position { line: 169, column: 24 }, missingPlugin: [ 'optionalChaining' ]

添加区块,点击确定,无法添加;

Context

cumtb1909 commented 4 years ago

bug

cumtb1909 commented 4 years ago

安装下这个,问题就解决了,npm install babel-plugin-dynamic-import-webpack --save-dev,简直了!

msiripan commented 4 years ago

Hi @cumtb1909 ,

安装下这个,问题就解决了,npm install babel-plugin-dynamic-import-webpack --save-dev,简直了!

Do you mind to share your package.json? I followed your suggestion above but no luck still got an error. Btw i use yarn instead of npm.

XinYueXiao commented 3 years ago

感觉进入了死循环,安装了,启动时说这个就说Cannot find module '@umijs/preset-ui' from '/Users/wangxinyue/popmart/matrix' 安装了 @umijs/preset-ui 启动成功就This experimental syntax requires enabling the parser plugin: 'optionalChaining' (169:24)

Cool-Star commented 3 years ago

最后有解决的方法吗?