任何人都可以帮助我解决这个问题。其实我不明白如何在 React 18 中使用 Vite。因为在 2023 年我们不使用 create-react-app。
使用这个的完整解决方案
yarn create vite react-vite --template react-ts
cd react-vite
yarn install
yarn run dev
//or
first go into the folder
npm create vite@latest
Choose a name for the project. That will also be the project’s folder name. In this case “test”:
Now you can choose a framework. Pick “React”.
Pick JavaScript or TypeScript, whatever you prefer. You can optionally use SWC.
Done now run
cd test
vnpm install
npm run dev
Choose a name for the project. That will also be the project’s folder name. In this case “test”: