change clientEntry sequence

This commit is contained in:
tamaina 2022-05-01 22:21:21 +09:00
parent 03cd6965fa
commit 743393d9ba
2 changed files with 6 additions and 15 deletions

View File

@ -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'),
} : {}),
},
}));

View File

@ -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