vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
3.01k stars 158 forks source link

Error building after last update #63

Closed miguelfspinto closed 3 years ago

miguelfspinto commented 3 years ago

Hi,

After the last update for version 0.8, i cannot run build on my app:

RROR Failed to compile with 42 errors7:36:04 PM error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'computed' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'createApp' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'customRef' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'defineComponent' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'del' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'getCurrentInstance' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'h' from non EcmaScript module (only default export is available)

antfu commented 3 years ago

Can't reproduce on my side, can you try a clean install or provide a minimal reproduction? Thanks

lstoeferle commented 3 years ago

For me it's the same error after upgrading to v0.8. I use it in a vue2 web-component project, where vue and @vue/composition-api are located in the devDependencies.

antfu commented 3 years ago

Can I have the content of vue-demi/lib/index.esm.mjs? Still, ideally a repro is preferred.

lstoeferle commented 3 years ago

Unfortunately I can not share the repo, since it belongs to the company I'm working for :( vue2, vue-demi, @vue/composition-api, @vue/cli (webcomponent build), webpack

// vue-demi/lib/index.esm.mjs
import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'

function install(_vue) {
  _vue = _vue || Vue
  if (_vue && !_vue['__composition_api_installed__'])
    Vue.use(VueCompositionAPI)
}

install(Vue)

var isVue2 = true
var isVue3 = false
var Vue2 = Vue
var version = Vue.version

/**VCA-EXPORTS**/
export { computed, createApp, createRef, customRef, defineAsyncComponent, defineComponent, del, getCurrentInstance, h, inject, isRaw, isReactive, isReadonly, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useCSSModule, useCssModule, warn, watch, watchEffect } from '@vue/composition-api'
/**VCA-EXPORTS**/

export {
  Vue,
  Vue2,
  isVue2,
  isVue3,
  version,
  install,
}
miguelfspinto commented 3 years ago

Still having the same error after update 0.8.1 @antfu , i'm gonna add you to the repo. Do you have gitlab account?

error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'computed' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'createApp' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'customRef' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'defineComponent' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'del' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs Can't reexport the named export 'getCurrentInstance' from non EcmaScript module (only default export is available) error in ./node_modules/@vueuse/core/node_modules/vue-demi/lib/index.esm.mjs

fk1blow commented 3 years ago

i m having the same issue on osx with node v15.14.0. I m specifying the node version b/c the same app running on ubuntu with node v12.20.0 seems fine

fedeee commented 3 years ago

FYI: this also relates to: https://github.com/vuejs/vue-apollo/issues/1190

antfu commented 3 years ago

0.9.0 released. Would need some help to confirm if it's a fix. Thanks!

fk1blow commented 3 years ago

@antfu i m having @vueuse/core as a dependency so i could try that one specifically

fedeee commented 3 years ago

This seems to have fixed it for us

JuroOravec commented 3 years ago

@antfu 0.9.0 fixes the issue with vuejs/vue-apollo (vuejs/vue-apollo#1190), thanks!

jzs11 commented 3 years ago

This error is coming back after upgrade to the latest

image

Muchmorepig commented 3 years ago

I met the same issue: image

jzs11 commented 3 years ago

Try this - https://github.com/vueuse/vueuse/issues/718#issuecomment-913319680 it works for me