Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to visual editing – shallowequal does not provide an export named 'default' (at styled-components.browser.esm.js?v=ca1ca438:4:8) #1159

Open
3 tasks done
MichaelPrecel opened this issue Feb 13, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@MichaelPrecel
Copy link

Version

module: 1.13.3
nuxt: 3.15.4

Nuxt configuration

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: false },

  future: {
    compatibilityVersion: 4,
  },

  modules: ["@nuxtjs/sanity"],

  sanity: {
    apiVersion: "2025-02-13",
    projectId: "3jds3t8i",
    dataset: "production",
    visualEditing: {
      studioUrl: "http://localhost:3333",
      token: "",
    },
  },

  compatibilityDate: "2025-02-13",
});

Reproduction

Minimal reproduction:
https://github.com/MichaelPrecel/Nuxt-Sanity-Visual-Editing-issue-reproduction/tree/main

What is actually happening?

Visual editing is unable to connect. Receiving error

Uncaught (in promise) SyntaxError: The requested module '/_nuxt/@fs/Users/michaelprecel/Sites/EACH/each-minimal-repro/Nuxt-Sanity-Visual-Editing-issue-reproduction/nuxt-repro/node_modules/.pnpm/[email protected]/node_modules/shallowequal/index.js?v=ef34c05a' does not provide an export named 'default' (at styled-components.browser.esm.js?v=ef34c05a:4:8)

Image

Steps to reproduce

  1. Pnpm install both nuxt-repro and sanity-repro
  2. Run pnpm dev on both nuxt and sanity folders
  3. In Sanity, enter Presentation mode
  4. Open browser console to see issue

Additional information

Checklist

  • I have tested with the latest Nuxt version and the issue still occurs
  • I have tested with the latest module version and the issue still occurs
  • I have searched the issue tracker and this issue hasn't been reported yet

Package.json

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@nuxtjs/sanity": "1.13.3",
    "@sanity/client": "^6.28.0",
    "nuxt": "^3.15.4",
    "react": "18",
    "vue": "latest",
    "vue-router": "latest"
  }
}

What is actually happening?

@MichaelPrecel MichaelPrecel added the bug Something isn't working label Feb 13, 2025
@tlebeitsuk
Copy link

tlebeitsuk commented Feb 17, 2025

I'm getting the same error.

Adding this to nuxt.config.ts fixes it:

vite: {
  optimizeDeps: {
    include: ["shallowequal", "lodash/startCase.js"],
  },
},

@MichaelPrecel
Copy link
Author

After manually installing shallowequal and lodash, this fixed it for me too – thank you @tlebeitsuk – LIFESAVER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants