vueuse: Nuxt / Webpack / Vue CLI build fails with v6.2.0 and above
Since 6.2.0, Nuxt fails to build (I think because of the changed file extensions):
[fatal] Nuxt build error
ERROR in ./node_modules/@vueuse/core/index.mjs 800:50-62
Can't import the named export 'bypassFilter' from non EcmaScript module (only default export is available)
@ ./layouts/default.vue?vue&type=script&lang=js& (./node_modules/cache-loader/dist/cjs.js??ref--2-0!./node_modules/babel-loader/lib??ref--2-1!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=script&lang=js&)
@ ./layouts/default.vue?vue&type=script&lang=js&
@ ./layouts/default.vue
@ ./node_modules/.cache/nuxt/App.js
@ ./node_modules/.cache/nuxt/index.js
@ ./node_modules/.cache/nuxt/client.js
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/composition-api/register.js ./node_modules/.cache/nuxt/client.js
ERROR in ./node_modules/@vueuse/core/index.mjs 3271:25-30
Can't import the named export 'clamp' from non EcmaScript module (only default export is available)
@ ./layouts/default.vue?vue&type=script&lang=js& (./node_modules/cache-loader/dist/cjs.js??ref--2-0!./node_modules/babel-loader/lib??ref--2-1!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=script&lang=js&)
@ ./layouts/default.vue?vue&type=script&lang=js&
@ ./layouts/default.vue
@ ./node_modules/.cache/nuxt/App.js
@ ./node_modules/.cache/nuxt/index.js
@ ./node_modules/.cache/nuxt/client.js
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/composition-api/register.js ./node_modules/.cache/nuxt/client.js
4500+ lines ...
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 21 (15 by maintainers)
I found this can confirmed it fixes the same issue on Vue CLI
https://stackoverflow.com/a/64907659
Nuxt
Vue CLI
/cc @pi0 @danielroe @sodatea I am not super familiar what is going on internally in webpack, but if this fix makes sense, should we include it by default in Nuxt / Vue CLI?
Nuxt
The
extendmethod is an option of thebuildproperty, so the correct configuration should beLikely this should be included by default for wp4 in Vue CLI. It should already be present in next version of Nuxt (2.16): https://github.com/nuxt/nuxt.js/pull/9180
And it is already injected by
@nuxtjs/composition-apiwhen that is being usedIf you’re using Vue CLI 4, please upgrade to latest version. https://github.com/vuejs/vue-cli/releases/tag/v4.5.15
The way I see it is that Webpack 4 should release a patch to have built-in support for .mjs files (Note that Webpack 5, Vite, Rollup are working fine with this). Giving the whole ecosystem is moving in that direction, it’s not a problem that is only limited to this library.
For some context:
I cannot reproduce it with a new nuxt repo, so it has to be somewhere in my configuration or modules. I will have to fix that myself 😃
@patrikengborg Would you check whether there is a problem when you upgrade to the latest version of node 12 or 14 (and also ensure you are using the latest version of vue composition API).