diff --git a/hwe/index.php b/hwe/index.php
index 512b5c6c..b2c0b649 100644
--- a/hwe/index.php
+++ b/hwe/index.php
@@ -118,15 +118,9 @@ if (!$otherTextInfo) {
= WebUtil::printJS('../d_shared/common_path.js') ?>
= WebUtil::printJS('d_shared/base_map.js') ?>
- = WebUtil::printJS('dist_js/vendors_vue.js', true) ?>
- = WebUtil::printJS('dist_js/common_vue.js', true) ?>
- = WebUtil::printJS('dist_js/v_main.js', true) ?>
-
= WebUtil::printCSS('../d_shared/common.css') ?>
- = WebUtil::printCSS('dist_css/common.css') ?>
+ = WebUtil::printDist('vue', 'v_main', true) ?>
- = WebUtil::printCSS('dist_css/common_vue.css') ?>
- = WebUtil::printCSS('dist_css/v_main.css') ?>
= WebUtil::printCSS('css/map.css') ?>
= WebUtil::printStaticValues([
'serverNick' => DB::prefix(),
diff --git a/hwe/ts/v_main.ts b/hwe/ts/v_main.ts
index d20f92e7..a2a1b1fb 100644
--- a/hwe/ts/v_main.ts
+++ b/hwe/ts/v_main.ts
@@ -1,4 +1,5 @@
import '@scss/main.scss';
+import "@scss/common_legacy.scss";
exportWindow(scrollHardTo, 'scrollHardTo');
diff --git a/src/sammo/WebUtil.php b/src/sammo/WebUtil.php
index cc93c471..e61d3457 100644
--- a/src/sammo/WebUtil.php
+++ b/src/sammo/WebUtil.php
@@ -139,6 +139,43 @@ class WebUtil
return static::preloadAsset($path, 'script');
}
+ public static function printDist(string $type, string|array $entryName, bool $isDefer = false){
+ if(is_string($entryName)){
+ $entryName = [$entryName];
+ }
+ if(is_subclass_of('\\sammo\\VersionGit', '\\sammo\\VersionGitDynamic')){
+ $version = DB::prefix().'_dynamic';
+ }
+ else{
+ $version = VersionGit::getVersion();
+ }
+
+ $basePath = dirname(__DIR__, 2)."/dist_js/{$version}/{$type}";
+ $serverBasePath = \phpUri::parse(ServConfig::$serverWebPath)->path;
+ $serverBasePath .= "/dist_js/{$version}/{$type}";
+
+ $outputs = ["\n"];
+
+ foreach(["vendors", "common_ts", ...$entryName] as $moduleName){
+ foreach(['js', 'css'] as $ext){
+ $checkPath = $basePath."/{$moduleName}.{$ext}";
+ if (!file_exists($checkPath)) {
+ $outputs[] = "\n";
+ continue;
+ }
+ $mtime = filemtime($checkPath);
+ if($ext == 'css'){
+ $outputs[] = "\n";
+ }
+ else if($ext == 'js'){
+ $typeText = $isDefer ? 'defer' : '';
+ $outputs[] = "\n";
+ }
+ }
+ }
+ return join("", $outputs);
+ }
+
public static function printJS(string $path, bool $isDefer = false)
{
//async 옵션 고려?
diff --git a/webpack.config.cjs b/webpack.config.cjs
index 5942ae29..c1639052 100644
--- a/webpack.config.cjs
+++ b/webpack.config.cjs
@@ -33,7 +33,7 @@ module.exports = (env, argv) => {
let emitDone = false;
let writeDone = false;
return function (percentage, msg, ...args) {
- if(msg == 'emitting'){
+ if (msg == 'emitting') {
emitDone = true;
}
if (percentage == 0) {
@@ -59,6 +59,33 @@ module.exports = (env, argv) => {
entryIngame[entry] = `${tsDir}/${filePath}`;
}
+ const optimization = {
+ splitChunks: {
+ cacheGroups: {
+ commons: {
+ test: /[\\/]node_modules[\\/]/,
+ name: 'vendors',
+ priority: -10,
+ chunks: 'all',
+ reuseExistingChunk: true,
+ },
+ default: {
+ name: 'common_ts',
+ minChunks: 2,
+ priority: -20,
+ chunks: 'all',
+ reuseExistingChunk: true,
+ },
+ },
+ },
+ minimizer: [
+ new ESBuildMinifyPlugin({
+ css: true
+ }),
+ ],
+ moduleIds: 'deterministic',
+ };
+
const ingame_vue = {
name: `ingame_${versionTarget}_vue`,
resolve: {
@@ -77,32 +104,7 @@ module.exports = (env, argv) => {
path: resolve(outputPath, 'vue')
},
devtool: 'source-map',
- optimization: {
- splitChunks: {
- cacheGroups: {
- commons: {
- test: /[\\/]node_modules[\\/]/,
- name: 'vendors_vue',
- priority: -10,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- default: {
- name: 'common_vue',
- minChunks: 2,
- priority: -20,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- },
- },
- minimizer: [
- new ESBuildMinifyPlugin({
- css: true
- }),
- ],
- moduleIds: 'deterministic',
- },
+ optimization,
module: {
rules: [
//FROM `vue inspect` and some tweaks
@@ -211,30 +213,7 @@ module.exports = (env, argv) => {
path: resolve(outputPath, 'ts')
},
devtool: 'source-map',
- optimization: {
- splitChunks: {
- cacheGroups: {
- commons: {
- test: /[\\/]node_modules[\\/]/,
- name: 'vendors',
- chunks: 'all',
- },
- default: {
- name: 'common_ts',
- minChunks: 2,
- priority: -20,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- },
- },
- minimizer: [
- new ESBuildMinifyPlugin({
- css: true
- }),
- ],
- moduleIds: 'deterministic',
- },
+ optimization,
module: {
rules: [{
test: /\.ts$/,
@@ -319,30 +298,7 @@ module.exports = (env, argv) => {
path: resolve(outputPath, 'gateway')
},
devtool: 'source-map',
- optimization: {
- splitChunks: {
- cacheGroups: {
- commons: {
- test: /[\\/]node_modules[\\/]/,
- name: 'vendors',
- chunks: 'all',
- },
- default: {
- name: 'common_ts',
- minChunks: 2,
- priority: -20,
- chunks: 'all',
- reuseExistingChunk: true,
- },
- },
- },
- minimizer: [
- new ESBuildMinifyPlugin({
- css: true
- }),
- ],
- moduleIds: 'deterministic',
- },
+ optimization,
module: {
rules: [{
test: /\.ts$/,
@@ -397,9 +353,8 @@ module.exports = (env, argv) => {
},
};
- if(env.WEBPACK_WATCH || !versionValue){
- return [ingame_vue];
- //return [gateway, ingame_vue, ingame];
+ if (env.WEBPACK_WATCH || !versionValue) {
+ return [gateway, ingame_vue, ingame];
}
const buildConfList = [];