question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"export 'default' (imported as 'defu') was not found in 'defu'

See original GitHub issue

(as the other issue closed, maybe this one is a different case)

Sorry for the delay in testing the new version. It seems that new release 5.13.5 makes nuxt render the page properly, but now when visiting the page after npm run dev, the following error appears on chrome console:

image

Please note that:

  • I ran npm update and indeed I’m running version 5.13.5
  • from package-lock.json:
    "@nuxtjs/axios": {
      "version": "5.13.5",
      "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.13.5.tgz",
      "integrity": "sha512-GyeuiseDCwfRGDQH/gK+lngCseZS3SQm3q6xqiVx5xQnzCqokojN3uJkNB0DdHCowBP1aim+mDhu3spzcCnyBg==",
      "requires": {
        "@nuxtjs/proxy": "^2.1.0",
        "axios": "^0.21.1",
        "axios-retry": "^3.1.9",
        "consola": "^2.15.3",
        "defu": "^5.0.0"
      },
  • Tried deleting both node_modules and .nuxt to avoid some inconsistency issue
  • Tried switching between node 12 and 14 just in case
  • At nuxt dev output it just shows this now:
"export 'default' (imported as 'defu') was not found in 'defu'                                friendly-errors 16:23:18

Also seen on Chrome console:

[HMR] bundle 'client' has 1 warnings
client.js?1b93:196 ./.nuxt/axios.js 73:31-35"export 'default' (imported as 'defu') was not found in 'defu'

This is happening on the same project that uses babel transpile for some reason (I think we should get rid of IE11 anyway).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Sonit90commented, Apr 19, 2022

I cannot fix the issue with pnpm, npm, yarn.

To reproduce - clone this: https://github.com/antfu/vitesse-nuxt-bridge

Uncaught SyntaxError: The requested module ‘/_nuxt/node_modules/defu/dist/defu.cjs?import’ does not provide an export named ‘defu’ (at composables.mjs:3:10)

1reaction
rodrigopvcommented, Jun 6, 2021

Hi,

I think i’ve found something important regarding this bug. It seems that switching npm for yarn would resolve the issue. That means that it must be related to dependency resolution.

I noticed that unlike the example sandbox from @pi0, the project that I’m working on doesn’t include

    "defu": "^5.0.0",

on it’s package.json

  • Running yarn on the project without yarn.lock (because they use npm) would solve the bug.
  • Running npm install after that would make the error appear again.
  • Running npm update won’t fix the bug.
  • Using nuxt-edge (issue still present) doesn’t solve the bug. - Adding "defu": "^5.0.0" to package.json and then running npm install again solves the issue.

What doesn’t work:

  • Using nuxt-edge (issue still present)

To reproduce:

  1. Have a working project with "@nuxtjs/axios": "5.13.1", (locked version)
  2. Modify it to "@nuxtjs/axios": "^5.13.1",
  3. run npm update "@nuxtjs/axios" so npm lockfile shows "version": "5.13.6",
  4. "export 'default' (imported as 'defu') was not found in 'defu'should appear now
  5. run npm install defu --save and expect the error to be gone

package-lock.json diff from the commented steps:

--- a/dashboard/package-lock.json
+++ b/dashboard/package-lock.json
@@ -2040,24 +2040,21 @@
       }
     },
     "@nuxtjs/axios": {
-      "version": "5.13.1",
-      "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.13.1.tgz",
-      "integrity": "sha512-vZpXV2AAkQ5Duejubt1k3ZgUnYowYnPvmcUt0hskd+OebmQ+jF6Wk6rOG0/9EeknOxm7mtTGgKSwdlE1jDo+xA==",
+      "version": "5.13.6",
+      "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.13.6.tgz",
+      "integrity": "sha512-XS+pOE0xsDODs1zAIbo95A0LKlilvJi8YW0NoXYuq3/jjxGgWDxizZ6Yx0AIIjZOoGsXJOPc0/BcnSEUQ2mFBA==",
       "requires": {
         "@nuxtjs/proxy": "^2.1.0",
         "axios": "^0.21.1",
         "axios-retry": "^3.1.9",
         "consola": "^2.15.3",
-        "defu": "^3.2.2"
+        "defu": "^5.0.0"
       },
       "dependencies": {
-        "axios": {
-          "version": "0.21.1",
-          "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
-          "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
-          "requires": {
-            "follow-redirects": "^1.10.0"
-          }
+        "defu": {
+          "version": "5.0.0",
+          "resolved": "https://registry.npmjs.org/defu/-/defu-5.0.0.tgz",
+          "integrity": "sha512-VHg73EDeRXlu7oYWRmmrNp/nl7QkdXUxkQQKig0Zk8daNmm84AbGoC8Be6/VVLJEKxn12hR0UBmz8O+xQiAPKQ=="
         }
       }
     },
@@ -5207,9 +5204,9 @@
       }
     },
     "defu": {
-      "version": "3.2.2",
-      "resolved": "https://registry.npmjs.org/defu/-/defu-3.2.2.tgz",
-      "integrity": "sha512-8UWj5lNv7HD+kB0e9w77Z7TdQlbUYDVWqITLHNqFIn6khrNHv5WQo38Dcm1f6HeNyZf0U7UbPf6WeZDSdCzGDQ=="
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/defu/-/defu-5.0.0.tgz",
+      "integrity": "sha512-VHg73EDeRXlu7oYWRmmrNp/nl7QkdXUxkQQKig0Zk8daNmm84AbGoC8Be6/VVLJEKxn12hR0UBmz8O+xQiAPKQ=="
     },
     "degenerator": {
       "version": "2.2.0",
@@ -12723,6 +12720,13 @@
       "integrity": "sha512-DC7t66WeIrlVzVMzickfHIn1zHu7eMsVNiH0nkD/wCrijFQdvgyfH2zc5lkFf79EApUgRhZntkpKjfgLkn2i/Q==",
       "requires": {
         "defu": "^3.2.2"
+      },
+      "dependencies": {
+        "defu": {
+          "version": "3.2.2",
+          "resolved": "https://registry.npmjs.org/defu/-/defu-3.2.2.tgz",
+          "integrity": "sha512-8UWj5lNv7HD+kB0e9w77Z7TdQlbUYDVWqITLHNqFIn6khrNHv5WQo38Dcm1f6HeNyZf0U7UbPf6WeZDSdCzGDQ=="
+        }
       }
     },
     "serve-static": {
Read more comments on GitHub >

github_iconTop Results From Across the Web

Export default was not found - Stack Overflow
"What am I doing wrong?" You are trying to import the default export of a module which does not have a default export....
Read more >
export 'render' (imported as 'render') was not found - You.com
The reason this is happening is because in Vue 2, Vue provides a default export export default vue , which allows BootstrapVue to...
Read more >
nuxt-community - Bountysource
"export 'default' (imported as 'defu') was not found in 'defu' $ 0. Created 1 year ago in nuxt-community/axios-module with 7 comments. (as the...
Read more >
defu | Yarn - Package Manager
defu. Assign default properties, recursively. Lightweight and Fast! ... 6.1.0 (2022-08-16). Features. export Defu type helper (#45 (551ae4c) ...
Read more >
Introduction to Nuxt 3 modules - DEV Community ‍ ‍
import defu from 'defu' import { resolve } from 'pathe' import { defineNuxtModule, addPlugin } from '@nuxt/kit' export default ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found