Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: dumi Markdown引入第三方包报错 #2185

Closed
parlay96 opened this issue Aug 10, 2024 · 14 comments
Closed

bug: dumi Markdown引入第三方包报错 #2185

parlay96 opened this issue Aug 10, 2024 · 14 comments

Comments

@parlay96
Copy link

Version

2.3

OS Version

win

Node.js Version

18.16.1

Browser Version

google 127.0

Link to minimal reproduction

dumi Markdown引入第三方包报错

Steps to reproduce

dumi Markdown引入第三方包:

import React from "react";
// 这是因为dumi文档找不到module
import { Close as CloseIcon, Thumb } from "fish-icons";
export default () => (
  <>
    <CloseIcon size="20px" color="red" />
    <Thumb size={20} color="#000" style={{ marginLeft: "8px" }} />
  </>
);
报错ReferenceError: module is not defined

### What is expected?

dumi Markdown引入第三方包:
```jsx
import React from "react";
// 这是因为dumi文档找不到module
import { Close as CloseIcon, Thumb } from "fish-icons";
export default () => (
  <>
    <CloseIcon size="20px" color="red" />
    <Thumb size={20} color="#000" style={{ marginLeft: "8px" }} />
  </>
);
报错ReferenceError: module is not defined

### What is actually happening?

dumi Markdown引入第三方包:
```jsx
import React from "react";
// 这是因为dumi文档找不到module
import { Close as CloseIcon, Thumb } from "fish-icons";
export default () => (
  <>
    <CloseIcon size="20px" color="red" />
    <Thumb size={20} color="#000" style={{ marginLeft: "8px" }} />
  </>
);
报错ReferenceError: module is not defined

### Any additional comments? (optional)

_No response_
@parlay96
Copy link
Author

其实我fish-icons 暴露了es模块入口了的

@parlay96
Copy link
Author

他默认去找了common.js模块

@parlay96
Copy link
Author

image
image
dumi md文件 默认去找main

@Jinbao1001
Copy link
Member

试试看 chainWebpack -> memo.resolve.byDependency.set('commonjs', {});

@parlay96
Copy link
Author

parlay96 commented Aug 13, 2024

@Jinbao1001
image
image

好像不行

@parlay96
Copy link
Author

@Jinbao1001 谢谢你

@Jinbao1001
Copy link
Member

Jinbao1001 commented Aug 13, 2024

@Jinbao1001 image image

好像不行

好的, 已知问题, 编译cjs导致的, 这两天我会发版修复掉

@parlay96
Copy link
Author

@Jinbao1001 幸苦了 发了告诉我下

@Jinbao1001
Copy link
Member

Jinbao1001 commented Aug 15, 2024

@parlay96 方便测试一下么? 看看有没有引发别的问题 2.4.8-beta.3

@parlay96
Copy link
Author

@Jinbao1001 我明天试试看,不过你就该这个bug 应该发版也没啥吧

@Jinbao1001
Copy link
Member

Jinbao1001 commented Aug 15, 2024

@Jinbao1001 我明天试试看,不过你就该这个bug 应该发版也没啥吧

影响蛮大的. demodeps引入规则都改掉了, 构建器在interop 包装后不知道会不会触发其它依赖问题.

@Jinbao1001
Copy link
Member

@parlay96 有测试一下吗?

@parlay96
Copy link
Author

@parlay96 有测试一下吗?

image
image

感觉没啥问题

@Jinbao1001
Copy link
Member

Jinbao1001 commented Aug 23, 2024

closed #2187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants