fix(bridge): do not resolve esm babel helpers (#1158)

This commit is contained in:
Daniel Roe 2021-10-18 11:12:01 +01:00 committed by GitHub
parent 870a62855c
commit adf497046b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -9,9 +9,6 @@ export function setupAppBridge (_options: any) {
nuxt.options.alias['#app'] = resolve(distDir, 'runtime/index.mjs')
nuxt.options.alias['#build'] = nuxt.options.buildDir
// Alias vuex to its esm version, as vuex.mjs currently exports cjs: https://github.com/vuejs/vuex/pull/2073
nuxt.options.alias.vuex = 'vuex/dist/vuex.esm.js'
// 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 })
for (const alias of [

View File

@ -43,6 +43,10 @@ class EnhancedResolverPlugin {
// Fall back to default webpack4 resolver if not a node_modules import
if (!id || !defaultResolver.isModule(id)) { return }
// Fall back to webpack4 resolver if resolving babel helpers
// https://github.com/nuxt/nuxt.js/blob/714249740690569eedf74aa7bca7ed31c01953d4/packages/babel-preset-app/src/index.js#L169
if (id.includes('/@babel/')) { return }
const importer = request.context?.issuer
try {
const result = await enhancedResolver.resolve(id, importer)