ant-design / pro-editor

🕹️ The Ultimate Editor UI Framework and Components
https://pro-editor.antdigital.dev
MIT License
199 stars 25 forks source link

[Bug] Server Error SyntaxError: Cannot use import statement outside a module #140

Closed kemisstep closed 8 months ago

kemisstep commented 8 months ago
"antd": "^5.12.8",
"antd-style": "^3.6.1",
"@ant-design/pro-editor": "^0.38.0",
"next": "13.5.6",
"react": "^18",
kemisstep commented 8 months ago

已经在nextConfig 设置了,但是不起效果: const nextConfig = { // 将纯 esm 模块转为 node 兼容模块 transpilePackages: ['@ant-design/pro-editor', 'leva'], // leva 为 ProEditor 依赖模块 };

kemisstep commented 8 months ago

类似问题:

🐛[BUG] SyntaxError: Cannot use import statement outside a module, NEXTJS 13 · Issue #6525 · ant-design/pro-components

ONLY-yours commented 8 months ago

@kemisstep 试试配置下这个,我到时候在文档里面补充详细下关于 NextJs 配置的情况

 transpilePackages: [
    '@ant-design/pro-flow-editor',
    '@ant-design/pro-editor',
    'zustand',
    'leva',
    'ahooks',
  ],
kemisstep commented 8 months ago

最后发现,这个玩意是有先后顺序的,需要放置再前面