如何解决模板包错误?

How to resolve a stencil bundle error?

在捆绑主题时,我一直在处理 stencil 时抛出一个错误,导致无法完成捆绑。真是不知所措

这里是来自控制台日志的控制台日志:

E:\stencil>stencil bundle Validating theme... Running ESLint...

E:\stencil\assets\js\theme\common\carousel.js 22:159 error Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag

E:\stencil\assets\js\theme\common\product-details.js 300:15 warning Function 'updateView' has a complexity of 13 complexity

✖ 2 个问题(1 个错误,1 个警告)

C:\Users\Kyle\AppData\Roaming\npm\node_modules\@bigcommerce\stencil-cli\lib\stencil-bundle.js:255 throw err; ^ Error: Please fix the above Javascript errors. at runLintTask (C:\Users\Kyle\AppData\Roaming\npm\node_modules\@bigcommerce\stencil-cli\lib\bundle-validator.js:268:18) at C:\Users\Kyle\AppData\Roaming\npm\node_modules\@bigcommerce\stencil-cli\node_modules\async\lib\async.js:718:13 at Immediate.iterate [as _onImmediate] (C:\Users\Kyle\AppData\Roaming\npm\node_modules\@bigcommerce\stencil-cli\node_modules\async\lib\async.js:262:13) at processImmediate [as _immediateCallback] (timers.js:367:17)

E:\stencil>

看起来 ESLint 不喜欢你的一些 JS。您可以尝试降低 .eslintrc 文件中的规则的严格性,甚至完全删除该文件,因为这不是必需的。

删除文件后再次尝试捆绑。

有关 eslint 的更多信息 here