modern.js
modern.js copied to clipboard
[Bug]: 开启 `Rspress Module Doc` 功能,代码块设置 iframe,报 Can't resolve 'react/jsx-dev-runtime'
版本信息
System:
OS: Linux 6.8 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
CPU: (8) x64 AMD Ryzen 7 5825U with Radeon Graphics
Memory: 8.12 GB / 15.62 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
npmPackages:
@modern-js/eslint-config: 2.58.0 => 2.58.0
@modern-js/module-tools: 2.58.0 => 2.58.0
@modern-js/plugin-rspress: 1.27.1 => 1.27.1
@modern-js/plugin-tailwindcss: 2.58.0 => 2.58.0
问题详情
初始化项目, 开启 Rspress Module Doc 功能,在 doc/index.mdx 中 输入代码块,并设置类型为 iframe,pnpm dev 后报 Can't resolve 'react/jsx-dev-runtime'
demo: test.tar.gz
复现链接
附件 test.tar.gz
复现步骤
pnpm dev- 控制台报错
File: /home/beacon/Documents/test/node_modules/.rspress/virtual-demo/_index_1.entry.tsx:1:1
× Module not found: Can't resolve 'react/jsx-dev-runtime' in '/home/beacon/Documents/test/node_modules/.rspress/virtual-demo'
╭─[1:34]
1 │ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
· ───────────────────────
2 │ import { render } from 'react-dom';
3 │ import "/home/beacon/Documents/test/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]__react-_yafijyfmxaorishhjxftxnjjba/node_modules/@rspress/plugin-preview/static/global-styles/entry.css";
╰────