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]: 开启 Rspress Module Doc 功能,代码块设置 iframe,报 Can't resolve 'react/jsx-dev-runtime' #6060

Open
BeaconSage opened this issue Aug 9, 2024 · 0 comments
Labels
bug Something isn't working Modern.js Module

Comments

@BeaconSage
Copy link

版本信息

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 中 输入代码块,并设置类型为 iframepnpm dev 后报 Can't resolve 'react/jsx-dev-runtime'
截屏2024-08-10 00 33 29

demo:
test.tar.gz

复现链接

附件 test.tar.gz

复现步骤

  1. pnpm dev
  2. 控制台报错
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/@rspress+plugin-preview@1.27.1_@babel+core@7.25.2_@rspress+core@1.27.1_webpack@5.93.0__react-_yafijyfmxaorishhjxftxnjjba/node_modules/@rspress/plugin-preview/static/global-styles/entry.css";
   ╰────
@BeaconSage BeaconSage added the bug Something isn't working label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Modern.js Module
Projects
None yet
Development

No branches or pull requests

2 participants