Git Product home page Git Product logo

Comments (4)

yunsii avatar yunsii commented on June 1, 2024

https://github.com/antfu/unplugin-auto-import/blob/main/src/presets/react.ts has contains the project custom auto-import https://github.com/yunsii/vite-react/blob/master/vite.config.ts#L27

So, you can use autoImport plugin directly without custom imports

from vite-react.

ryuujo1573 avatar ryuujo1573 commented on June 1, 2024

Nonetheless I was cloning without significant modification, ran into runtime error finally.
I was wondering why this would happen.

failed to load config from /Users/_____/foodSDU/vite.config.ts
error when starting dev server:
Error: [auto-import] identifier useImperativeHandle already defined with react
    at /Users/_____/foodSDU/node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin-auto-import/dist/chunk-KSE6FVK6.js:63:17
    at Array.forEach (<anonymous>)
    at flattenImportsMap (/Users/_____/foodSDU/node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin-auto-import/dist/chunk-KSE6FVK6.js:42:36)
    at resolveOptions (/Users/_____/foodSDU/node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin-auto-import/dist/chunk-KSE6FVK6.js:18:19)
    at /Users/_____/foodSDU/node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin-auto-import/dist/chunk-KSE6FVK6.js:235:18
    at /Users/_____/foodSDU/node_modules/.pnpm/[email protected][email protected]/node_modules/unplugin/dist/index.js:965:23
    at Object.<anonymous> (/Users/_____/foodSDU/vite.config.ts:97:29)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.require.extensions.<computed> [as .ts] (/Users/_____/foodSDU/node_modules/.pnpm/[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-c9998dc6.js:61998:20)
    at Module.load (node:internal/modules/cjs/loader:981:32)
 ELIFECYCLE  Command failed with exit code 1.

from vite-react.

ryuujo1573 avatar ryuujo1573 commented on June 1, 2024

Using pnpm might cause the error.

I've turned to yarn and added two peer deps

prop-types@^15.5.7
rollup@^2.0.0

This fixed the problem. Thank you.

from vite-react.

yunsii avatar yunsii commented on June 1, 2024

Yep, the project has yarn.lock, use yarn will be ok.

from vite-react.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.