From 743393d9ba8620a05b0fca79d8da991711e3f21e Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 1 May 2022 22:21:21 +0900 Subject: [PATCH] change clientEntry sequence --- packages/backend/src/server/web/index.ts | 8 +++----- packages/backend/src/server/web/views/base.pug | 13 +++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index dcaa91c9fc..9e31f2389e 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -74,12 +74,10 @@ app.use(views(_dirname + '/views', { extension: 'pug', options: { version: config.version, + clientEntry: () => process.env.NODE_ENV === 'production' ? + config.clientEntry : + JSON.parse(readFileSync(`${_dirname}/../../../../../built/_client_dist_/manifest.json`, 'utf-8'))['src/init.ts'].file.replace(/^_client_dist_\//, ''), config, - ...(process.env.NODE_ENV !== 'production' ? { - process, - _dirname, - readFileSync: (path: PathOrFileDescriptor): string => readFileSync(path, 'utf8'), - } : {}), }, })); diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index c2ae39c1fd..d79354d118 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -50,16 +50,9 @@ html style include ../style.css - if process.env.NODE_ENV === 'production' - script. - var VERSION = "#{version}"; - var CLIENT_ENTRY = "#{config.clientEntry}"; - else - - - const clientEntry = JSON.parse(readFileSync(`${_dirname}/../../../../../built/_client_dist_/manifest.json`, 'utf-8'))['src/init.ts'].file.replace(/^_client_dist_\//, ''); - script. - var VERSION = "#{version}"; - var CLIENT_ENTRY = "#{clientEntry}"; + script. + var VERSION = "#{version}"; + var CLIENT_ENTRY = "#{clientEntry()}"; script include ../boot.js