Skip to content

Commit

Permalink
fix: compatibility issue with Nuxt 2.15.0 (#1064)
Browse files Browse the repository at this point in the history
Resolves #1063
  • Loading branch information
rchl authored Feb 15, 2021
2 parents 7086cb4 + d946ca1 commit b549272
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ export function buildHook (moduleContainer, options) {
// Add vue-i18n-loader if applicable
if (options.vueI18nLoader) {
moduleContainer.extendBuild(config => {
const loaders = config.module.rules.find(el => el.loader === 'vue-loader').options.loaders
if (loaders) {
const vueLoader = config.module.rules.find(el => el.loader.includes('vue-loader'))
if (vueLoader && vueLoader.options && vueLoader.options.loaders) {
// vue-loader under 15.0.0
/* istanbul ignore next */
loaders.i18n = '@intlify/vue-i18n-loader'
vueLoader.options.loaders.i18n = require.resolve('@intlify/vue-i18n-loader')
} else {
// vue-loader after 15.0.0
config.module.rules.push({
resourceQuery: /blockType=i18n/,
type: 'javascript/auto',
loader: '@intlify/vue-i18n-loader'
loader: require.resolve('@intlify/vue-i18n-loader')
})
}
})
Expand Down

0 comments on commit b549272

Please sign in to comment.