build: install and configure Vite, move index.html

This commit is contained in:
Daniel D Orlando 2023-04-01 12:58:49 -07:00
parent 78dabe55ae
commit 6498ab79a4
7 changed files with 2271 additions and 11 deletions

View file

@ -26,15 +26,16 @@
/>
<script
defer
src="/main.js"
type="module"
src="/src/main.jsx"
></script>
</head>
<body>
<div id="root"></div>
<script
type="text/javascript"
src="/main.js"
type="module"
src="/src/main.jsx"
></script>
</body>
</html>

View file

@ -2,9 +2,11 @@
"name": "chatgpt-clone",
"version": "0.2.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"build": "webpack",
"build": "vite build",
"dev": "vite",
"preview-prod": "vite preview",
"build-dev": "Webpack . --watch"
},
"repository": {

View file

@ -4,10 +4,10 @@ import { createRoot } from 'react-dom/client';
// import { store } from './src/store';
import { RecoilRoot } from 'recoil';
import { ThemeProvider } from './src/hooks/ThemeContext';
import App from './src/App';
import './src/style.css';
import './src/mobile.css';
import { ThemeProvider } from './hooks/ThemeContext';
import App from './App';
import './style.css';
import './mobile.css';
const container = document.getElementById('root');
const root = createRoot(container);

View file

@ -1,9 +1,31 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": false,
"module": "ESNext",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"isolatedModules": true,
"noImplicitAny": false,
"noEmit": false,
"jsx": "react-jsx",
"baseUrl": ".",
"jsx": "react",
"paths": {
"~/*": ["./src/*"]
}
}
},
"include": [
"src"
],
}

40
client/vite.config.ts Normal file
View file

@ -0,0 +1,40 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: "localhost",
port: 3090,
strictPort: false,
proxy: {
"/api": {
target: "http://localhost:3080",
changeOrigin: true,
}
}
},
plugins: [react()],
build: {
sourcemap: true,
outDir: "./public",
},
resolve: {
alias: {
"~": path.join(__dirname, "src/"),
},
},
define: {
// global: {},
// process: {
// env: {
// VITE_APP_API: process?.env.VITE_APP_API || 'production',
// },
// },
},
});
// module.exports = {
// plugins: [require("tailwindcss")],
// };

2188
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

7
package.json Normal file
View file

@ -0,0 +1,7 @@
{
"devDependencies": {
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.1",
"vite-plugin-html": "^3.2.0"
}
}