Skip to content

Nuxt Prismic + Nuxt Supabase lead to cookie lib error due to slice-machine-ui #228

@gabrielstuff

Description

@gabrielstuff

Hello and thanks for the amazing work,

I’m not sure if this belongs here or in the slice-machine-ui repository, but the issue began while I was following the tutorial to install Prismic in my Nuxt project. The root problem seems to be that slice-machine-ui also depends on cookie module through its dependency on express. I’m unsure of the best way to resolve this easily.

Versions

  • nuxt: 3.15.0
  • @nuxtjs/prismic: 3.3.0
  • node: v20.6.1
"dependencies": {
    "@nuxtjs/supabase": "1.4.5",
    "nuxt": "^3.15.0",
    "vue": "latest",
    "vue-router": "latest"
  },
  "devDependencies": {
    "@nuxtjs/prismic": "^3.3.0",
    "@slicemachine/adapter-nuxt": "^0.3.61",
    "slice-machine-ui": "^2.11.1"
  }

Reproduction

Additional Details

When using @nuxtjs/supabase with @nuxtjs/prismic, the application throws a runtime error:

Uncaught SyntaxError: The requested module does not provide an export named 'parse'

This happens because @supabase/ssr depends on the cookie module, and imports { parse } from it. However, the cookie module is exported as CommonJS (CJS), which doesn’t have named exports, leading to this issue in Nuxt's ESM environment.

Steps to Reproduce

  1. Clone the provided StackBlitz example.
  2. Install dependencies (npm install or pnpm install).
  3. Run the project (npm run dev or pnpm dev).
  4. Open the browser console and observe the error:
    Uncaught SyntaxError: The requested module does not provide an export named 'parse'
    

What is Expected?

  • The Nuxt app should successfully compile and render without import/export errors.

What is Actually Happening?

  • The app throw a warning at runtime. It throws a syntax error about a missing named export parse from the cookie module.

Workaround

  1. Override the cookie version in package.json cause multiple versions are causing conflicts:
"resolutions": {
    "cookie": "0.7.2"
  }

This workaround should resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesPull requests that update a dependency filedo not trackDo not track this issue on the Prismic OSS Dashboard

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions