From 69e205ba36befcbe943b83501825185b4b113453 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 15 Nov 2023 22:37:05 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20manualChunks=E3=81=AE=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=8C=E8=AA=A4=E3=81=A3=E3=81=A6=E3=81=84=E3=81=A6?= =?UTF-8?q?=E3=83=93=E3=83=AB=E3=83=89=E5=86=8D=E7=8F=BE=E6=80=A7=E3=81=8C?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index ec53aa91a..ab783999c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -51,10 +51,11 @@ export default defineConfig(({ command, mode }) => ({ if (['@traptitech/traq/', 'axios'].some(t => id.includes(t))) { return 'apis' } - if (id.includes('node_modules/highlight.js')) { + const hljsLangs = 'node_modules/highlight.js/lib/languages/' + const hljsLangIndex = id.indexOf(hljsLangs) + if (id.includes(hljsLangs)) { // hljsは適当に二つに分割する - const t = 'node_modules/highlight.js/lib/languages/' - const firstLetter = id.slice(id.indexOf(t) + t.length)[0] + const firstLetter = id.slice(hljsLangIndex + hljsLangs.length)[0] if (firstLetter < 'i') { return 'hljs' } From ba4cef7328271b46a944814b0914c389781b0cb9 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 15 Nov 2023 22:41:22 +0900 Subject: [PATCH 2/2] refactor: slice + index access --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index ab783999c..59b26360b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -55,7 +55,7 @@ export default defineConfig(({ command, mode }) => ({ const hljsLangIndex = id.indexOf(hljsLangs) if (id.includes(hljsLangs)) { // hljsは適当に二つに分割する - const firstLetter = id.slice(hljsLangIndex + hljsLangs.length)[0] + const firstLetter = id[hljsLangIndex + hljsLangs.length] if (firstLetter < 'i') { return 'hljs' }