Skip to content

Instantly share code, notes, and snippets.

@mattbryson
Created March 31, 2022 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbryson/23ca32f972380f1770bf3c136e6009d6 to your computer and use it in GitHub Desktop.
Save mattbryson/23ca32f972380f1770bf3c136e6009d6 to your computer and use it in GitHub Desktop.
Patch to get vue-cli-plugin-i18n working in a mono repo
const { defineConfig } = require('@vue/cli-service');
const path = require('path');
module.exports = defineConfig({
chainWebpack: (config) => {
// Fix vue-cli-plugin-i18n broken path to the locales folder in a mono repo
config.module
.rule('i18n-resource')
.include.clear().add(path.resolve(__dirname, 'src/locales'));
},
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'locales', // in a mono repo this resolves an invalid path - like /User/bob/repo_root/src/locales - rather than /User/bob/repo_root/packages/package_root/src/locales
enableLegacy: false,
compositionOnly: true,
fullInstall: false,
runtimeOnly: true
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment