Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jan 28, 2021
0 parents commit a4f29c0
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
22 changes: 22 additions & 0 deletions examples/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"scripts": {
"start:": "npm install && npm run build:vite-plugin-ssr && npm run start:server",
"start:server": "ts-node-dev server.ts",
"build:vite-plugin-ssr": "cd ../../ && npm run build"
},
"dependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"devDependencies": {
"@types/node": "^14.14.22",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react-refresh": "^1.1.2",
"express": "^4.17.1",
"ts-node": "^9.1.1",
"ts-node-dev": "^1.1.1",
"typescript": "^4.1.3",
"vite": "^2.0.0-beta.50"
}
}
23 changes: 23 additions & 0 deletions examples/react/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as vite from "vite";
import * as express from "express";

startServer();

async function startServer() {
const app = express();

const viteServer = await vite.createServer({
server: {
middlewareMode: true,
},
});
app.use(viteServer.middlewares);

app.use("*", (_, res) => {
res.send("hello");
});

const port = 3000;
app.listen(port);
console.log(`Server running at http://localhost:${port}`);
}
8 changes: 8 additions & 0 deletions examples/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"strict": true,
"lib": ["DOM"],
"jsx": "react",
"esModuleInterop": true
}
}
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"workspaces": [
"src/"
],
"scripts": {
"// Demo": "",
"demo": "cd examples/vue/ && npm run start",
"// Dev": "",
"dev": "npm install && npm run build:watch",
"// Build": "",
"build": "npm install && npm run build:once",
"build:once": "tsc --build",
"build:watch": "tsc --build --watch"
},
"devDependencies": {
"typescript": "^4.1.3"
}
}

0 comments on commit a4f29c0

Please sign in to comment.