Skip to content

Commit 2b8cd9e

Browse files
committed
fix: Require loadLanguageAsync only when needed
1 parent b066266 commit 2b8cd9e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/templates/i18n.plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Vue from 'vue'
22
import VueI18n from 'vue-i18n'
3-
import { loadLanguageAsync } from './i18n.utils'
43

54
Vue.use(VueI18n)
65

@@ -24,6 +23,7 @@ export default ({ app, route, error }) => {
2423
}
2524
app.i18n.locale = locale
2625
if (<%= options.loadLanguagesAsync %>) {
26+
const { loadLanguageAsync } = require('./i18n.utils')
2727
loadLanguageAsync(app.i18n, app.i18n.locale)
2828
}
2929
}

lib/templates/i18n.routing.middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import middleware from './middleware'
2-
import { loadLanguageAsync } from './i18n.utils'
32

43
middleware['i18n'] = function ({ app, route, redirect, error, hotReload }) {
54
const locales = <%= JSON.stringify(options.locales) %>
@@ -28,6 +27,7 @@ middleware['i18n'] = function ({ app, route, redirect, error, hotReload }) {
2827
}
2928
if (locale === app.i18n.locale) return
3029
if (<%= options.loadLanguagesAsync %>) {
30+
const { loadLanguageAsync } = require('./i18n.utils')
3131
loadLanguageAsync(app.i18n, locale)
3232
.then(() => {
3333
app.i18n.locale = locale

0 commit comments

Comments
 (0)