Open wztlink1013 opened 1 week ago
I encountered an issue with oniguruma-to-js
when using it alongside ProChat. The issue seems related to the recent update of pro-editor, which ProChat uses as a dependency. Specifically, the update to pro-editor 15 days ago is likely causing this error when installing ProChat again. The package version is as follows:
"@ant-design/pro-editor": "latest"
Temporary Fix While I do not recommend this as a long-term solution, I was able to temporarily resolve the issue by disabling regex within the oniguruma-to-js package. I am unsure of the potential side effects, so proceed with caution.
Here are the steps I followed:
Navigate to the oniguruma-to-js directory in your project.
/node_modules/oniguruma-to-js/dist/shared/oniguruma-to-js.2969e22d.mjs
Disable regex imports by modifying the file:
// import { rewrite } from 'regex';
.
.
.
// if (useRegex) {
// output = rewrite(
// output,
// {
// flags: flagStr,
// unicodeSetsPlugin: null,
// disable: {
// n: true,
// v: true,
// x: true
// }
// }
// ).expression;
// }
Applying the Patch
After modifying the file, create a patch to persist these changes:
npx patch-package oniguruma-to-js
Also update your scripts in your package.json
"scripts": {
"postinstall": "patch-package"
},
Note This is not a recommended approach for production environments, as it might have unintended side effects. However, this temporary fix has resolved the issue in my case.
🐛 bug 描述
打包报错
去掉
"@ant-design/pro-chat": "^1.15.2",
打包构建正常📷 复现步骤
如上截图
🏞 期望结果
正常构建
💻 复现代码
可复现 demo
© 版本信息
均是antd相关最新依赖
🚑 其他信息