Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bundle-utils,unplugin-vue-i18n): pkg option for getVueI18nVersion #369

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/bundle-utils/src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ export function checkInstallPackage(
)
}

type VueI18nVersion = '8' | '9' | 'unknown' | ''
type VueI18nVersion = '9' | 'unknown' | ''

export function getVueI18nVersion(debug: Function): VueI18nVersion {
const VueI18n = loadModule('vue-i18n', debug)
export function getVueI18nVersion(
debug: Function,
pkg = 'vue-i18n'
): VueI18nVersion {
const VueI18n = loadModule(pkg, debug)
if (VueI18n == null) {
return ''
}
if (VueI18n.version && VueI18n.version.startsWith('8.')) {
return '8'
}
if (VueI18n.VERSION && VueI18n.VERSION.startsWith('9.')) {
return '9'
}
Expand Down
4 changes: 0 additions & 4 deletions packages/unplugin-vue-i18n/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ const debug = createDebug('unplugin-vue-i18n')
const installedPkg = checkInstallPackage('@intlify/unplugin-vue-i18n', debug)
const vueI18nVersion = getVueI18nVersion(debug)

if (vueI18nVersion === '8') {
warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`)
}

export const unplugin = createUnplugin<PluginOptions>((options = {}, meta) => {
debug('plugin options:', options, meta.framework)

Expand Down