Decouple client from server
Add Vite dependency and remove server side rendering to make it
possible to run the client independently.
Remove webpack config, replace with the `Vite` build tool.
GitLab: #55
Change-Id: I3a05d2e86cf6cb0ab91e77b3696f393132137575
diff --git a/app.ts b/app.ts
index 2f5f837..793453c 100644
--- a/app.ts
+++ b/app.ts
@@ -29,7 +29,6 @@
import { Account } from 'jami-web-common';
import passport from 'passport';
import { IVerifyOptions, Strategy as LocalStrategy } from 'passport-local';
-import path from 'path';
import { Server, Socket } from 'socket.io';
import { ExtendedError } from 'socket.io/dist/namespace';
@@ -121,21 +120,6 @@
origin: 'http://127.0.0.1:3000',
};
- if (nodeEnv === 'development') {
- const webpack = await import('webpack');
- const webpackDev = await import('webpack-dev-middleware');
- const webpackHot = await import('webpack-hot-middleware');
- const { default: webpackConfig } = await import('jami-web-client/webpack.config.js');
-
- const compiler = webpack.default(webpackConfig);
- app.use(
- webpackDev.default(compiler, {
- publicPath: webpackConfig.output?.publicPath,
- })
- );
- app.use(webpackHot.default(compiler));
- }
-
/*
Configuation for Passeport Js
*/
@@ -326,17 +310,6 @@
app.use('/', indexRouter);
- /* GET React App */
-
- const cwd = process.cwd();
- app.use(express.static(path.join(cwd, 'client/dist')));
-
- app.use((req, res) => {
- res.render(path.join(cwd, 'client/dist/index.ejs'), {
- initdata: JSON.stringify(getState(req)),
- });
- });
-
// @ts-ignore TODO: Fix the typescript error
const server = http.Server(app);
@@ -391,5 +364,5 @@
loadConfig(configPath)
.then(createServer)
.then((server) => {
- server.listen(3000);
+ server.listen(3001);
});