From 5e53e6d06e8d18f0871dfa673acd100c2f2e9e7a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 30 Oct 2022 00:58:33 +0300 Subject: Bundle server with esbuild --- vnext/server/bootstrap.js | 11 ----------- vnext/server/index.js | 2 +- vnext/server/middleware/renderer.js | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 vnext/server/bootstrap.js (limited to 'vnext/server') diff --git a/vnext/server/bootstrap.js b/vnext/server/bootstrap.js deleted file mode 100644 index 0f920886..00000000 --- a/vnext/server/bootstrap.js +++ /dev/null @@ -1,11 +0,0 @@ -require('ignore-styles'); -require('url-loader'); -require('file-loader'); -require('@babel/register')({ - ignore: [/(node_modules)/], - presets: [ - '@babel/preset-env', - ['@babel/preset-react', { 'runtime': 'automatic' }] - ] -}); -require('./index'); diff --git a/vnext/server/index.js b/vnext/server/index.js index 12093b1b..5840b586 100644 --- a/vnext/server/index.js +++ b/vnext/server/index.js @@ -20,7 +20,7 @@ router.use('^/$', serverRenderer); // other static resources should just be served as they are router.use(express.static( - path.resolve(__dirname, '..', 'dist'), + path.resolve(__dirname), { maxAge: '30d' }, )); diff --git a/vnext/server/middleware/renderer.js b/vnext/server/middleware/renderer.js index 6cc0b61b..4223d7f2 100644 --- a/vnext/server/middleware/renderer.js +++ b/vnext/server/middleware/renderer.js @@ -23,7 +23,7 @@ function toBinary(string) { const serverRenderer = async (req, res) => { // point to the html file created by CRA's build tool - const filePath = path.resolve(__dirname, '..', '..', 'dist', 'index.html'); + const filePath = path.resolve('index.html'); // links const cookies = cookie.parse(req.headers.cookie || ''); -- cgit v1.2.3