Skip to content

Commit

Permalink
migrate vite build
Browse files Browse the repository at this point in the history
  • Loading branch information
Dereje1 committed Apr 20, 2023
1 parent 22ba3e4 commit c7d530f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"jsx": "react-jsx",
},
"include": ["src", "index.d.ts"],
"references": [{ "path": "tsconfig.node.json" }]
"references": [{ "path": "../tsconfig.vite.json" }]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"scripts": {
"start": "node ./server_build/bin/www",
"build_server": "tsc -p ./server && tsc -p ./bin",
"build_client": "webpack --mode production",
"build_client": "vite build",
"client": "vite",
"server": "nodemon ./bin/www.ts",
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",
"lint": "./node_modules/.bin/eslint server client tests",
"test": "jest --watch",
"coverage": "jest --coverage",
"compileTS": "tsc -p ./client && tsc -p ./server --noEmit && tsc -p ./tests/tsconfig.test.json"
"compileTS": "tsc -p ./client && tsc -p ./server --noEmit && tsc -p ./tests/tsconfig.test.json",
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.7.1",
Expand Down
4 changes: 2 additions & 2 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ App.use((request: Request, response: Response, next: NextFunction) => {
next();
});
// serve webpack build client
App.use(express.static(path.join(__dirname, '../client/public')));
App.use(express.static(path.join(__dirname, '../client/dist')));
// connect to db and setup authentication / passport
connectToDB();
auth(
Expand All @@ -60,7 +60,7 @@ auth(
App.use(router);
// serve webpack build client
App.get('*', (req: Request, res: Response) => {
res.sendFile(path.resolve(__dirname, '../client/public', 'index.html'));
res.sendFile(path.resolve(__dirname, '../client/dist', 'index.html'));
});

// catch 404 and forward to error handler
Expand Down
2 changes: 1 addition & 1 deletion client/tsconfig.node.json → tsconfig.vite.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["../vite.config.ts"]
"include": ["vite.config.ts"]
}

0 comments on commit c7d530f

Please sign in to comment.