-
Notifications
You must be signed in to change notification settings - Fork 475
Expand file tree
/
Copy pathvite-react-ts.ts
More file actions
128 lines (123 loc) · 2.95 KB
/
vite-react-ts.ts
File metadata and controls
128 lines (123 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import { commonFiles } from "../common";
export const VITE_REACT_TS_TEMPLATE = {
files: {
...commonFiles,
"/App.tsx": {
code: `export default function App() {
const data: string = "world"
return <h1>Hello {data}</h1>
}
`,
},
"/index.tsx": {
code: `import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./styles.css";
import App from "./App";
import React from "react";
const root = createRoot(document.getElementById("root") as HTMLElement);
root.render(
<StrictMode>
<App />
</StrictMode>
);
`,
},
"/index.html": {
code: `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/index.tsx"></script>
</body>
</html>
`,
},
"/tsconfig.json": {
code: JSON.stringify(
{
compilerOptions: {
target: "ESNext",
useDefineForClassFields: true,
lib: ["DOM", "DOM.Iterable", "ESNext"],
allowJs: false,
skipLibCheck: true,
esModuleInterop: false,
allowSyntheticDefaultImports: true,
strict: true,
forceConsistentCasingInFileNames: true,
module: "ESNext",
moduleResolution: "Node",
resolveJsonModule: true,
isolatedModules: true,
noEmit: true,
jsx: "react-jsx",
},
include: ["src"],
references: [{ path: "./tsconfig.node.json" }],
},
null,
2
),
},
"/tsconfig.node.json": {
code: JSON.stringify(
{
compilerOptions: {
composite: true,
module: "ESNext",
moduleResolution: "Node",
allowSyntheticDefaultImports: true,
},
include: ["vite.config.ts"],
},
null,
2
),
},
"/package.json": {
code: JSON.stringify(
{
scripts: {
dev: "vite",
build: "tsc && vite build",
preview: "vite preview",
},
dependencies: {
react: "^19.0.0",
"react-dom": "^19.0.0",
},
devDependencies: {
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^4.3.4",
typescript: "^4.9.5",
vite: "4.2.0",
"esbuild-wasm": "^0.17.12",
},
},
null,
2
),
},
"/vite-env.d.ts": {
code: '/// <reference types="vite/client" />',
},
"/vite.config.ts": {
code: `import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
`,
},
},
main: "/App.tsx",
environment: "node",
};