target별 JS 생성

This commit is contained in:
2021-08-25 02:44:46 +09:00
parent fa109c1b0b
commit 4d8b816acf
2 changed files with 47 additions and 27 deletions
+7
View File
@@ -28,6 +28,10 @@ function getHash($target = 'HEAD')
return trim($output); return trim($output);
} }
function genJS($server){
exec(sprintf("./node_modules/.bin/webpack build --env target=%s", escapeshellarg($server)));
}
$session = Session::requireLogin(null)->setReadOnly(); $session = Session::requireLogin(null)->setReadOnly();
$request = $_POST + $_GET; $request = $_POST + $_GET;
@@ -172,6 +176,8 @@ if ($server == $baseServerName) {
); );
} }
genJS($server);
if (ServConfig::$imageRequestKey) { if (ServConfig::$imageRequestKey) {
try { try {
$imagePullPath = ServConfig::getImagePullURI(); $imagePullPath = ServConfig::getImagePullURI();
@@ -248,6 +254,7 @@ $result = Util::generateFileUsingSimpleTemplate(
], ],
true true
); );
genJS($server);
$storage->$server = [$target, $version]; $storage->$server = [$target, $version];
//ServConfig::getServerList()[$server]->closeServer(); //ServConfig::getServerList()[$server]->closeServer();
+40 -27
View File
@@ -2,39 +2,45 @@ const path = require('path');
const { VueLoaderPlugin } = require('vue-loader'); const { VueLoaderPlugin } = require('vue-loader');
const MiniCssExtractPlugin = require('mini-css-extract-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = [ const { resolve } = require('path');
{
module.exports = (env) => {
const target = env.target??'hwe';
const ingame = {
name: 'ingame', name: 'ingame',
resolve: { resolve: {
extensions: [".js", ".ts", ".tsx"] extensions: [".js", ".ts", ".tsx"],
alias: {
'@': resolve(__dirname, `${target}/ts`)
}
}, },
entry: { entry: {
chiefCenter: './hwe/ts/chiefCenter.ts', chiefCenter: `${target}/ts/chiefCenter.ts`,
inheritPoint: './hwe/ts/inheritPoint.ts', inheritPoint: `${target}/ts/inheritPoint.ts`,
common: './hwe/ts/common_deprecated.ts', common: `${target}/ts/common_deprecated.ts`,
troop: './hwe/ts/troop.ts', troop: `${target}/ts/troop.ts`,
map: './hwe/ts/map.ts', map: `${target}/ts/map.ts`,
install_db: './hwe/ts/install_db.ts', install_db: `${target}/ts/install_db.ts`,
install: './hwe/ts/install.ts', install: `${target}/ts/install.ts`,
battle_simulator: './hwe/ts/battle_simulator.ts', battle_simulator: `${target}/ts/battle_simulator.ts`,
recent_map: './hwe/ts/recent_map.ts', recent_map: `${target}/ts/recent_map.ts`,
processing: './hwe/ts/processing.ts', processing: `${target}/ts/processing.ts`,
select_npc: './hwe/ts/select_npc.ts', select_npc: `${target}/ts/select_npc.ts`,
betting: './hwe/ts/betting.ts', betting: `${target}/ts/betting.ts`,
board: './hwe/ts/board.ts', board: `${target}/ts/board.ts`,
bossInfo: './hwe/ts/bossInfo.ts', bossInfo: `${target}/ts/bossInfo.ts`,
myPage: './hwe/ts/myPage.ts', myPage: `${target}/ts/myPage.ts`,
//FORM 입력용, frontend 변경후 제거 //FORM 입력용, frontend 변경후 제거
defaultSelectCityByMap: './hwe/ts/defaultSelectCityByMap.ts', defaultSelectCityByMap: '@/defaultSelectCityByMap.ts',
defaultSelectNationByMap: './hwe/ts/defaultSelectNationByMap.ts', defaultSelectNationByMap: '@/defaultSelectNationByMap.ts',
colorSelect: './hwe/ts/colorSelect.ts', colorSelect: '@/colorSelect.ts',
recruitCrewForm: './hwe/ts/recruitCrewForm.ts' recruitCrewForm: '@/recruitCrewForm.ts'
}, },
output: { output: {
filename: '[name].js', filename: '[name].js',
path: path.resolve(__dirname, 'hwe/js'), path: resolve(__dirname, `${target}/js`)
}, },
mode: 'production', mode: 'production',
devtool: 'source-map', devtool: 'source-map',
@@ -99,8 +105,8 @@ module.exports = [
type: 'filesystem', type: 'filesystem',
allowCollectingMemory: true, allowCollectingMemory: true,
}, },
}, };
{ const gateway = {
name: 'gateway', name: 'gateway',
resolve: { resolve: {
extensions: [".js", ".ts", ".tsx"] extensions: [".js", ".ts", ".tsx"]
@@ -178,5 +184,12 @@ module.exports = [
type: 'filesystem', type: 'filesystem',
allowCollectingMemory: true, allowCollectingMemory: true,
}, },
}, };
]
if(target == 'hwe'){
return [ingame, gateway];
}
else{
return [ingame];
}
}