diff --git a/packages/core/server/src/locale/locale.ts b/packages/core/server/src/locale/locale.ts index d605ba5a4..0cf80f285 100644 --- a/packages/core/server/src/locale/locale.ts +++ b/packages/core/server/src/locale/locale.ts @@ -67,6 +67,9 @@ export class Locale { async getCacheResources(lang: string) { this.resourceCached.set(lang, true); + if (process.env.APP_ENV !== 'production') { + await this.cache.reset(); + } return await this.wrapCache(`resources:${lang}`, () => this.getResources(lang)); } diff --git a/packages/core/server/src/locale/resource.ts b/packages/core/server/src/locale/resource.ts index f9d7a56f7..43351be0a 100644 --- a/packages/core/server/src/locale/resource.ts +++ b/packages/core/server/src/locale/resource.ts @@ -25,7 +25,10 @@ export const getResource = (packageName: string, lang: string, isPlugin = true) for (const prefix of prefixes) { try { const file = `${packageName}/${prefix}/locale/${lang}`; - require.resolve(file); + const f = require.resolve(file); + if (process.env.APP_ENV !== 'production') { + delete require.cache[f]; + } const resource = requireModule(file); resources.push(resource); } catch (error) {