This template provides a boilerplate setup to get React working in Vite with HMR, Eslint, Prettier, Vitest and the Image-tool plugin of Vite.
Note: The initial project was created with
npm create vite@latest . -- --template react-swc-ts
npm install -D tailwindcss clsx autoprefixer postcss
npx tailwindcss init
and then configure tailwind.config.js along with postcss.config.js
npm install -D prettier-plugin-tailwindcss @trivago/prettier-plugin-sort-imports prettier eslint-config-prettier
Configure .prettierc & .prettierignore files
npm install -D vite-imagetools
tsconfig
"paths": {
"@/*": ["./src/*"],
},
vite.config
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
npm install vitest jsdom @testing-library/jest-dom @testing-library/react @types/node --save-dev
Add test script in package.json
...
"test": "vitest"
...