Skip to content

Commit

Permalink
fix(lazy): only process lang files with js, ts and json extensions
Browse files Browse the repository at this point in the history
Resolves #1068
  • Loading branch information
rchl committed Feb 18, 2021
1 parent 4bfa890 commit 680484a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/templates/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export async function loadLanguageAsync (context, locale) {
}
if (!messages) {
try {
const langFileModule = await import(/* webpackChunkName: "lang-[request]" */ `~/<%= options.langDir %>${file}`)
const langFileModule = await import(
/* webpackChunkName: "lang-[request]" */
/* webpackInclude: /\.(js|ts|json)$/ */
`~/<%= options.langDir %>${file}`
)
const getter = langFileModule.default || langFileModule
messages = typeof getter === 'function' ? await Promise.resolve(getter(context, locale)) : getter
} catch (error) {
Expand Down

0 comments on commit 680484a

Please sign in to comment.