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

vite初始化react项目报错 #7690

Closed
7 tasks done
xiaolu-coding opened this issue Apr 12, 2022 · 4 comments
Closed
7 tasks done

vite初始化react项目报错 #7690

xiaolu-coding opened this issue Apr 12, 2022 · 4 comments

Comments

@xiaolu-coding
Copy link

xiaolu-coding commented Apr 12, 2022

Describe the bug

使用vite初始化react时报错

pnpm create vite
cd vite-project
pnpm intsall
pnpm rundev

Reproduction

[plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/.pnpm/react@17.0.2/node_modules/react/index.js" when it was imported here:

System Info

The original metadata for that path comes from when it was imported here:

    dep:react:1:23:
      1 │ export default require("./node_modules/.pnpm/react@17.0.2/node_modules/react/index.js");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:

   {
  -  "pluginName": null,
  +  "pluginName": "vite:dep-pre-bundle",
   }

  This is a bug in the "vite:dep-pre-bundle" plugin. Plugins provide metadata for a given path in an
  "onResolve" callback. All metadata provided for the same path must be consistent to ensure
  deterministic builds. Due to parallelism, one set of provided metadata will be randomly chosen for
  a given path, so providing inconsistent metadata for the same path can cause non-determinism.

Used Package Manager

pnpm

Logs

No response

Validations

@bompus
Copy link
Contributor

bompus commented Apr 12, 2022

Duplicate of #7683

@message163
Copy link

vite 2.9.1 降级 2.7.1 修复此问题
esbuild 降级 0.14.34 修复此问题

Vite 2.9.1 downgrade 2.7.1 fix this problem
Esbuild downgraded to 0.14.34 to fix this problem

@xiaolu-coding
Copy link
Author

Change vite to "vite": "~2.7.1" to solve the above problems

@patak-dev
Copy link
Member

For reference, esbuild 0.14.36 is out reverting the problematic change. Update esbuild to latest in your projects

@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants