Change React template from Vite to create-react-app.

This commit is contained in:
James Murdza 2024-07-31 17:09:24 -07:00
parent 2e68b0b537
commit a74f7bf71a
2 changed files with 32 additions and 32 deletions

View File

@ -158,7 +158,7 @@ io.on("connection", async (socket) => {
console.log("Created container ", data.sandboxId); console.log("Created container ", data.sandboxId);
io.emit( io.emit(
"previewURL", "previewURL",
"https://" + containers[data.sandboxId].getHostname(5173) "https://" + containers[data.sandboxId].getHostname(3000)
); );
} }
} catch (e: any) { } catch (e: any) {

View File

@ -21,49 +21,49 @@ const startercode = {
{ {
name: "package.json", name: "package.json",
body: `{ body: `{
"name": "react", "name": "react-app",
"version": "0.1.0",
"private": true, "private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": { "dependencies": {
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0",
"react-scripts": "5.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.2.66", "@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22", "@types/react-dom": "^18.2.22",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1", "eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0"
"eslint-plugin-react-refresh": "^0.4.6",
"vite": "^5.2.0"
} }
}`, }`,
}, },
{ {
name: "vite.config.js", name: "public/index.html",
body: `import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
host: "0.0.0.0",
}
})
`,
},
{
name: "index.html",
body: `<!doctype html> body: `<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
@ -133,7 +133,7 @@ export default App
`, `,
}, },
{ {
name: "src/main.jsx", name: "src/index.js",
body: `import React from 'react' body: `import React from 'react'
import ReactDOM from 'react-dom/client' import ReactDOM from 'react-dom/client'
import App from './App.jsx' import App from './App.jsx'