Skip to content

Commit 6abe244

Browse files
vsgoulartjanbiasi
authored andcommitted
feat: add vite v8 as peer dep
1 parent 3b4b325 commit 6abe244

20 files changed

Lines changed: 1068 additions & 74 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575
"peerDependencies": {
7676
"rollup": "^4",
77-
"vite": "^5 || ^6 || ^7",
77+
"vite": "^5 || ^6 || ^7 || ^8",
7878
"xmlbuilder2": "^3 || ^4"
7979
},
8080
"peerDependenciesMeta": {

pnpm-lock.yaml

Lines changed: 521 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
plugins: ['react-refresh'],
12+
rules: {
13+
'react-refresh/only-export-components': [
14+
'warn',
15+
{ allowConstantExport: true },
16+
],
17+
},
18+
}

test/fixtures/vite-v8/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

test/fixtures/vite-v8/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13+
14+
- Configure the top-level `parserOptions` property like this:
15+
16+
```js
17+
export default {
18+
// other rules...
19+
parserOptions: {
20+
ecmaVersion: 'latest',
21+
sourceType: 'module',
22+
project: ['./tsconfig.json', './tsconfig.node.json'],
23+
tsconfigRootDir: __dirname,
24+
},
25+
}
26+
```
27+
28+
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
29+
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
30+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list

test/fixtures/vite-v8/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

test/fixtures/vite-v8/package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@fixtures/vite-v8",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build --debug",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"react": "^19.1.1",
13+
"react-dom": "^19.1.1",
14+
"@mui/base": "5.0.0-beta.70",
15+
"react-remove-scroll": "2.7.1",
16+
"date-fns": "^4.1.0",
17+
"luxon": "3.7.1"
18+
},
19+
"devDependencies": {
20+
"@types/react": "^19.1.9",
21+
"@types/react-dom": "^19.1.7",
22+
"@types/luxon": "3.7.1",
23+
"@vitejs/plugin-react": "^6.0.1",
24+
"typescript": "5.9.3",
25+
"vite": "^8.0.0",
26+
"rollup-plugin-sbom": "workspace:*"
27+
}
28+
}
Lines changed: 1 addition & 0 deletions
Loading

test/fixtures/vite-v8/src/App.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+
8+
.logo {
9+
height: 6em;
10+
padding: 1.5em;
11+
will-change: filter;
12+
transition: filter 300ms;
13+
}
14+
.logo:hover {
15+
filter: drop-shadow(0 0 2em #646cffaa);
16+
}
17+
.logo.react:hover {
18+
filter: drop-shadow(0 0 2em #61dafbaa);
19+
}
20+
21+
@keyframes logo-spin {
22+
from {
23+
transform: rotate(0deg);
24+
}
25+
to {
26+
transform: rotate(360deg);
27+
}
28+
}
29+
30+
@media (prefers-reduced-motion: no-preference) {
31+
a:nth-of-type(2) .logo {
32+
animation: logo-spin infinite 20s linear;
33+
}
34+
}
35+
36+
.card {
37+
padding: 2em;
38+
}
39+
40+
.read-the-docs {
41+
color: #888;
42+
}

test/fixtures/vite-v8/src/App.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { lazy, Suspense, useState } from 'react'
2+
import reactLogo from './assets/react.svg'
3+
import viteLogo from '/vite.svg'
4+
import './App.css'
5+
import { ComponentWithDeps } from './ComponentWithDeps'
6+
7+
// internal dynamic import which includes other third party deps
8+
const DynamicComponent = lazy(() => import('./DynamicComponent').then(
9+
(mod) => ({
10+
default: mod.DynamicComponent
11+
})
12+
));
13+
14+
function App() {
15+
const [count, setCount] = useState(0)
16+
17+
18+
return (
19+
<>
20+
<div>
21+
<a href="https://vitejs.dev" target="_blank">
22+
<img src={viteLogo} className="logo" alt="Vite logo" />
23+
</a>
24+
<a href="https://react.dev" target="_blank">
25+
<img src={reactLogo} className="logo react" alt="React logo" />
26+
</a>
27+
</div>
28+
<h1>Vite + React</h1>
29+
<div className="card">
30+
<button onClick={() => setCount((count) => count + 1)}>
31+
count is {count}
32+
</button>
33+
<p>
34+
Edit <code>src/App.tsx</code> and save to test HMR
35+
</p>
36+
</div>
37+
<p className="read-the-docs">
38+
Click on the Vite and React logos to learn more
39+
</p>
40+
<ComponentWithDeps />
41+
<Suspense>
42+
<DynamicComponent />
43+
</Suspense>
44+
</>
45+
)
46+
}
47+
48+
export default App

0 commit comments

Comments
 (0)