fix(frontend): ビルド成果物のファイル名にlocalesのhashを含めるように (#16580)

This commit is contained in:
かっこかり 2025-09-24 17:01:48 +09:00 committed by GitHub
parent 0f8c068e84
commit 218070eb13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View File

@ -64,6 +64,8 @@ function toBase62(n: number): string {
} }
export function getConfig(): UserConfig { export function getConfig(): UserConfig {
const localesHash = toBase62(hash(JSON.stringify(locales)));
return { return {
base: '/embed_vite/', base: '/embed_vite/',
@ -148,9 +150,9 @@ export function getConfig(): UserConfig {
// dependencies of i18n.ts // dependencies of i18n.ts
'config': ['@@/js/config.js'], 'config': ['@@/js/config.js'],
}, },
entryFileNames: 'scripts/[hash:8].js', entryFileNames: `scripts/${localesHash}-[hash:8].js`,
chunkFileNames: 'scripts/[hash:8].js', chunkFileNames: `scripts/${localesHash}-[hash:8].js`,
assetFileNames: 'assets/[hash:8][extname]', assetFileNames: `assets/${localesHash}-[hash:8][extname]`,
paths(id) { paths(id) {
for (const p of externalPackages) { for (const p of externalPackages) {
if (p.match.test(id)) { if (p.match.test(id)) {

View File

@ -85,6 +85,8 @@ export function toBase62(n: number): string {
} }
export function getConfig(): UserConfig { export function getConfig(): UserConfig {
const localesHash = toBase62(hash(JSON.stringify(locales)));
return { return {
base: '/vite/', base: '/vite/',
@ -188,9 +190,9 @@ export function getConfig(): UserConfig {
// dependencies of i18n.ts // dependencies of i18n.ts
'config': ['@@/js/config.js'], 'config': ['@@/js/config.js'],
}, },
entryFileNames: 'scripts/[hash:8].js', entryFileNames: `scripts/${localesHash}-[hash:8].js`,
chunkFileNames: 'scripts/[hash:8].js', chunkFileNames: `scripts/${localesHash}-[hash:8].js`,
assetFileNames: 'assets/[hash:8][extname]', assetFileNames: `assets/${localesHash}-[hash:8][extname]`,
paths(id) { paths(id) {
for (const p of externalPackages) { for (const p of externalPackages) {
if (p.match.test(id)) { if (p.match.test(id)) {