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

我安装后使用遇到一个报错:'react/jsx-runtime' #45

Closed
Song-Yujun opened this issue Mar 15, 2023 · 1 comment
Closed

我安装后使用遇到一个报错:'react/jsx-runtime' #45

Song-Yujun opened this issue Mar 15, 2023 · 1 comment

Comments

@Song-Yujun
Copy link

Did you mean 'jsx-runtime.js'? BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.
我用的"react": "^17.0.2" / "antd": "^4.24.8" / "typescript": "^4.9.4"

@vikiboss
Copy link

我也遇到了,问题参考:facebook/react#20235

解决方案:facebook/react#20235 (comment)

项目的 jsx-runtime 引入有点问题,手动配置 alias,设置 react/jsx-runtime 的 alias 可以解决:

{
  alias: {
    'react/jsx-runtime': require.resolve('react/jsx-runtime')
    // 或者 'react/jsx-runtime': 'react/jsx-runtime.js'
  }
}

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

No branches or pull requests

3 participants