From d5127e95acfe1e4b124bf022c0949a793565b495 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 12 Oct 2021 21:16:43 +0100 Subject: [PATCH] fix(bridge): alias direct references to vue files (#847) --- packages/bridge/src/app.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/bridge/src/app.ts b/packages/bridge/src/app.ts index c8ecc7dc49..1761031cd8 100644 --- a/packages/bridge/src/app.ts +++ b/packages/bridge/src/app.ts @@ -11,8 +11,30 @@ export function setupAppBridge (_options: any) { // Alias vue to a vue3-compat version of vue2 nuxt.options.alias['#vue'] = nuxt.options.alias.vue || resolveModule('vue/dist/vue.runtime.esm.js', { paths: nuxt.options.modulesDir }) - nuxt.options.alias['@vue/shared'] = 'vue' - nuxt.options.alias['@vue/reactivity'] = 'vue' + for (const alias of [ + // vue 3 helper packages + '@vue/shared', + '@vue/reactivity', + ...[ + // vue 2 dist files + 'vue/dist/vue.common.dev', + 'vue/dist/vue.common', + 'vue/dist/vue.common.prod', + 'vue/dist/vue.esm.browser', + 'vue/dist/vue.esm.browser.min', + 'vue/dist/vue.esm', + 'vue/dist/vue', + 'vue/dist/vue.min', + 'vue/dist/vue.runtime.common.dev', + 'vue/dist/vue.runtime.common', + 'vue/dist/vue.runtime.common.prod', + 'vue/dist/vue.runtime.esm', + 'vue/dist/vue.runtime', + 'vue/dist/vue.runtime.min' + ].flatMap(m => [m, `${m}.js`]) + ]) { + nuxt.options.alias[alias] = 'vue' + } nuxt.options.alias.vue = resolve(distDir, 'runtime/vue.mjs') nuxt.options.build.transpile.push('vue')