Skip to content

Build problem RollupError: "toRegExp" is not exported by .... || 构建问题 RollupError: "toRegExp" 未从 .... 导出 #341

Open
@danyalutsevich

Description

Hello guys
I use Refine with antd template

    "@ant-design/icons": "^5.0.1",
    "@ant-design/pro-chat": "^1.15.0",
    "@refinedev/antd": "^5.37.4",
    "@refinedev/cli": "^2.16.40",
    "@refinedev/core": "^4.47.1",
    "@refinedev/devtools": "^1.2.10",
    "@refinedev/kbar": "^1.3.6",
    "@refinedev/react-router-v6": "^4.5.5",
    "@refinedev/supabase": "^5.7.4",
    "@uiw/react-md-editor": "^3.19.5",
    "antd": "^5.0.5",
    "antd-style": "^3.7.1",

I've added prochat and i get the following build error

➜  admin git:(base) ✗ npm run build

> [email protected] build
> tsc && refine build

vite v4.5.5 building for production...
transforming...
✓ 8409 modules transformed.
✓ built in 7.00s
"toRegExp" is not exported by "node_modules/oniguruma-to-es/dist/index.min.js", imported by "node_modules/@shikijs/engine-javascript/dist/index.mjs".
file: /Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/@shikijs/engine-javascript/dist/index.mjs:1:9
1: import { toRegExp } from 'oniguruma-to-es';
            ^
2:
3: var __defProp = Object.defineProperty;
error during build:
RollupError: "toRegExp" is not exported by "node_modules/oniguruma-to-es/dist/index.min.js", imported by "node_modules/@shikijs/engine-javascript/dist/index.mjs".
    at error (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at Module.error (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:13745:16)
    at Module.traceVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:14175:29)
    at ModuleScope.findVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:12615:39)
    at FunctionScope.findVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ChildScope.findVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at Identifier.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:8319:40)
    at CallExpression.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at CallExpression.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:9890:15)
    at ReturnStatement.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)

I dont understand how it can be fixed so im asking for your help
when i remove pro-chat everything is ok
the intresting part that it runs in dev mode but fails on build


Chinese translation

我使用 Refine 和 antd 模板

    "@ant-design/icons": "^5.0.1",
    "@ant-design/pro-chat": "^1.15.0",
    "@refinedev/antd": "^5.37.4",
    "@refinedev/cli": "^2.16.40",
    "@refinedev/core": "^4.47.1",
    "@refinedev/devtools": "^1.2.10",
    "@refinedev/kbar": "^1.3.6",
    "@refinedev/react-router-v6": "^4.5.5",
    "@refinedev/supabase": "^5.7.4",
    "@uiw/react-md-editor": "^3.19.5",
    "antd": "^5.0.5",
    "antd-style": "^3.7.1",

我添加了 prochat 后,出现了以下构建错误:

➜  admin git:(base) ✗ npm run build

> [email protected] build
> tsc && refine build

vite v4.5.5 building for production...
transforming...
✓ 8409 modules transformed.
✓ built in 7.00s
"toRegExp" is not exported by "node_modules/oniguruma-to-es/dist/index.min.js", imported by "node_modules/@shikijs/engine-javascript/dist/index.mjs".
file: /Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/@shikijs/engine-javascript/dist/index.mjs:1:9
1: import { toRegExp } from 'oniguruma-to-es';
            ^
2:
3: var __defProp = Object.defineProperty;
error during build:
RollupError: "toRegExp" is not exported by "node_modules/oniguruma-to-es/dist/index.min.js", imported by "node_modules/@shikijs/engine-javascript/dist/index.mjs".
    at error (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at Module.error (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:13745:16)
    at Module.traceVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:14175:29)
    at ModuleScope.findVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:12615:39)
    at FunctionScope.findVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at ChildScope.findVariable (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
    at Identifier.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:8319:40)
    at CallExpression.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)
    at CallExpression.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:9890:15)
    at ReturnStatement.bind (file:///Users/danlutsevich/Desktop/apps/autobot/admin/node_modules/rollup/dist/es/shared/node-entry.js:5892:23)

我不明白如何解决这个问题,所以在这里寻求帮助。 当我移除 pro-chat 时,一切正常。 有趣的是,开发模式可以运行,但构建时失败。

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions