jmix 2.2.1前端构建失败

  • jmix: 2.2.1
  • node 18.20.2
  • pnpm 9.0.4

Command E:\Application\nodejs\node.exe E:\Project\springboot\DnsWatch\node_modules\vite\bin\vite.js build:
error:
node_modules/ace-builds/src-noconflict/worker-coffee.js (5474:66): Use of eval in “node_modules/ace-builds/src-noconflict/worker-coffee.js” is strongly discouraged as it poses security risks and may cause issues with minification.
✓ 1744 modules transformed.
x Build failed in 17.11s
error during build:
TypeError: Cannot read properties of null (reading ‘render’)

新建项目,前端软件包都正常安装的

完整报错:error during build:
TypeError: Cannot read properties of null (reading ‘render’)
at LogicalExpression.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:11058:33)
at LogicalExpression.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:11070:24)
at SequenceExpression.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:11603:22)
at IfStatement.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:10208:23)
at renderStatementList (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:7664:25)
at BlockStatement.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:7830:13)
at FunctionDeclaration.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:4892:23)
at renderStatementList (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:7664:25)
at BlockStatement.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:7830:13)
at FunctionDeclaration.render (file:///E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js:4892:23)

ps: Caused by: com.vaadin.flow.server.ExecutionFailedException: Vite build exited with a non zero status

使用jmix 2.1.3版本则没有问题

似乎和vaadin的新版本bug相关
Error “Vite build exited with a non zero status” after upgrading von Vaadin23 / Spring Boot 2.7 to Vaadin24 / Spring Boot 3.2 · Issue #18472 · vaadin/flow · GitHub

这个可能是vite的一个bug。
打开 E:/Project/springboot/DnsWatch/node_modules/.pnpm/rollup@4.16.0/node_modules/rollup/dist/es/shared/node-entry.js 这个文件的 11058 行(可以直接在 IDEA 里点击报错信息中的文件链接)

这里的代码是这样的:
image

红框处返回了 null 导致了这个错误。

手动改成以下代码,再保存一下,重新启动就可以了:

const usedBranch = this.getUsedBranch();
if(usedBranch)
	this.getUsedBranch().render(code, options, {
		isCalleeOfRenderedParent,
		preventASI,
		renderedParentType: renderedParentType || this.parent.type,
		renderedSurroundingElement: renderedSurroundingElement || this.parent.type
	});

好的好的,我发现,package文件会被强制还原,就没法用.patch修复

感谢!今天下班还打扰。