Skip to content

Nuxt 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 #2692

@MichaelPrecel

Description

@MichaelPrecel

Encountering a tonne of issues with Nuxt and Sanity visual editing. Have opened this issue in the Nuxt module repo, but thought it might be worthwhile putting here as well in case the Sanity team have any suggestions.

Version

@nuxtjs/sanity 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"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions