umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.61k stars 1.18k forks source link

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

Closed parlay96 closed 3 months ago

parlay96 commented 3 months ago

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 commented 3 months ago

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

parlay96 commented 3 months ago

他默认去找了common.js模块

parlay96 commented 3 months ago

image image dumi md文件 默认去找main

Jinbao1001 commented 3 months ago

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

parlay96 commented 3 months ago

@Jinbao1001 image image

好像不行

parlay96 commented 3 months ago

@Jinbao1001 谢谢你

Jinbao1001 commented 3 months ago

@Jinbao1001 image image

好像不行

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

parlay96 commented 3 months ago

@Jinbao1001 幸苦了 发了告诉我下

Jinbao1001 commented 3 months ago

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

parlay96 commented 3 months ago

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

Jinbao1001 commented 3 months ago

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

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

Jinbao1001 commented 3 months ago

@parlay96 有测试一下吗?

parlay96 commented 3 months ago

@parlay96 有测试一下吗?

image image

感觉没啥问题

Jinbao1001 commented 3 months ago

closed #2187