Skip to content

next-sanity pulls in a huge amount of dependencies through sanity #3261

@mcmxcdev

Description

@mcmxcdev

Is your feature request related to a problem? Please describe.

next-sanity depends on sanity which pulls in A LOT of dependencies. This increases our lockfile LOC from 21k to 27k which is enormous for one dep.

I feel like there must be something misconfigured in sanity, e.g. dependencies should be hoisted to the respective packages they belong to rather than being defined on root.

sanity in our pnpm-workspace.yml:

  sanity@5.7.0(@emotion/is-prop-valid@1.4.0)(@swc/helpers@0.5.18)(@types/node@24.10.9)(@types/react-dom@19.2.3(@types/react@19.2.10))(@types/react@19.2.10)(babel-plugin-react-compiler@1.0.0)(bufferutil@4.1.0)(immer@11.1.3)(jiti@2.6.1)(lightningcss@1.30.2)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(styled-components@6.3.8(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(terser@5.44.1)(tsx@4.21.0)(typescript@5.9.3)(utf-8-validate@5.0.10)(vitest@4.0.18(@opentelemetry/api@1.9.0)(@types/node@24.10.9)(jiti@2.6.1)(jsdom@27.4.0(bufferutil@4.1.0)(utf-8-validate@5.0.10))(lightningcss@1.30.2)(msw@2.12.7(@types/node@24.10.9)(typescript@5.9.3))(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(yaml@2.8.2):
    dependencies:
      '@algorithm.ts/lcs': 4.0.5
      '@date-fns/tz': 1.4.1
      '@dnd-kit/core': 6.3.1(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
      '@dnd-kit/modifiers': 6.0.1(@dnd-kit/core@6.3.1(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react@19.2.4)
      '@dnd-kit/sortable': 7.0.2(@dnd-kit/core@6.3.1(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react@19.2.4)
      '@dnd-kit/utilities': 3.2.2(react@19.2.4)
      '@isaacs/ttlcache': 1.4.1
      '@juggle/resize-observer': 3.4.0
      '@mux/mux-player-react': 3.10.2(@types/react-dom@19.2.3(@types/react@19.2.10))(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
      '@portabletext/block-tools': 5.0.1(@types/react@19.2.10)(debug@4.4.3)
      '@portabletext/editor': 4.3.7(@portabletext/sanity-bridge@2.0.0(@types/react@19.2.10)(debug@4.4.3))(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(rxjs@7.8.2)
      '@portabletext/patches': 2.0.4
      '@portabletext/plugin-markdown-shortcuts': 5.0.22(@portabletext/editor@4.3.7(@portabletext/sanity-bridge@2.0.0(@types/react@19.2.10)(debug@4.4.3))(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(rxjs@7.8.2))(@types/react@19.2.10)(react@19.2.4)
      '@portabletext/plugin-one-line': 4.0.22(@portabletext/editor@4.3.7(@portabletext/sanity-bridge@2.0.0(@types/react@19.2.10)(debug@4.4.3))(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(rxjs@7.8.2))(react@19.2.4)
      '@portabletext/plugin-typography': 5.0.22(@portabletext/editor@4.3.7(@portabletext/sanity-bridge@2.0.0(@types/react@19.2.10)(debug@4.4.3))(@types/react@19.2.10)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(rxjs@7.8.2))(@types/react@19.2.10)(react@19.2.4)
      '@portabletext/react': 6.0.2(react@19.2.4)
      '@portabletext/sanity-bridge': 2.0.0(@types/react@19.2.10)(debug@4.4.3)
      '@portabletext/to-html': 5.0.1
      '@portabletext/toolkit': 5.0.1
      '@rexxars/react-json-inspector': 9.0.1(react@19.2.4)
      '@sanity/asset-utils': 2.3.0
      '@sanity/bifur-client': 0.4.1
      '@sanity/cli': 5.7.0(@types/node@24.10.9)(babel-plugin-react-compiler@1.0.0)(bufferutil@4.1.0)(lightningcss@1.30.2)(react@19.2.4)(terser@5.44.1)(tsx@4.21.0)(typescript@5.9.3)(utf-8-validate@5.0.10)(yaml@2.8.2)
      '@sanity/client': 7.14.1(debug@4.4.3)
      '@sanity/color': 3.0.6
      '@sanity/comlink': 4.0.1
      '@sanity/diff': 5.7.0
      '@sanity/diff-match-patch': 3.2.0
      '@sanity/diff-patch': 5.0.0
      '@sanity/eventsource': 5.0.2
      '@sanity/export': 6.0.5
      '@sanity/icons': 3.7.4(react@19.2.4)
      '@sanity/id-utils': 1.0.0
      '@sanity/image-url': 2.0.3
      '@sanity/import': 4.1.0(@types/node@24.10.9)(@types/react@19.2.10)(bufferutil@4.1.0)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(utf-8-validate@5.0.10)(yaml@2.8.2)
      '@sanity/insert-menu': 3.0.4(@emotion/is-prop-valid@1.4.0)(@sanity/types@5.7.0(@types/react@19.2.10))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(styled-components@6.3.8(react-dom@19.2.4(react@19.2.4))(react@19.2.4))
      '@sanity/logos': 2.2.2(react@19.2.4)
      '@sanity/media-library-types': 1.2.0
      '@sanity/message-protocol': 0.19.0
      '@sanity/migrate': 5.2.3(@swc/helpers@0.5.18)(@types/node@24.10.9)(@types/react@19.2.10)(bufferutil@4.1.0)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(utf-8-validate@5.0.10)(vitest@4.0.18(@opentelemetry/api@1.9.0)(@types/node@24.10.9)(jiti@2.6.1)(jsdom@27.4.0(bufferutil@4.1.0)(utf-8-validate@5.0.10))(lightningcss@1.30.2)(msw@2.12.7(@types/node@24.10.9)(typescript@5.9.3))(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(xstate@5.26.0)(yaml@2.8.2)
      '@sanity/mutator': 5.7.0(@types/react@19.2.10)
      '@sanity/presentation-comlink': 2.0.1(@sanity/client@7.14.1)(@sanity/types@5.7.0(@types/react@19.2.10))
      '@sanity/preview-url-secret': 4.0.3(@sanity/client@7.14.1)
      '@sanity/schema': 5.7.0(@types/react@19.2.10)(debug@4.4.3)
      '@sanity/sdk': 2.1.2(@types/react@19.2.10)(debug@4.4.3)(immer@11.1.3)(react@19.2.4)(use-sync-external-store@1.6.0(react@19.2.4))
      '@sanity/telemetry': 0.8.1(react@19.2.4)
      '@sanity/types': 5.7.0(@types/react@19.2.10)(debug@4.4.3)
      '@sanity/ui': 3.1.11(@emotion/is-prop-valid@1.4.0)(react-dom@19.2.4(react@19.2.4))(react-is@19.2.4)(react@19.2.4)(styled-components@6.3.8(react-dom@19.2.4(react@19.2.4))(react@19.2.4))
      '@sanity/util': 5.7.0(@types/react@19.2.10)(debug@4.4.3)
      '@sanity/uuid': 3.0.2
      '@sentry/react': 8.55.0(react@19.2.4)
      '@tanstack/react-table': 8.21.3(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
      '@tanstack/react-virtual': 3.13.18(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
      '@types/react-is': 19.2.0
      '@types/shallow-equals': 1.0.3
      '@types/speakingurl': 13.0.6
      '@types/tar-stream': 3.1.4
      '@types/use-sync-external-store': 1.5.0
      '@types/which': 3.0.4
      '@vitejs/plugin-react': 5.1.2(vite@7.3.1(@types/node@24.10.9)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))
      '@xstate/react': 6.0.0(@types/react@19.2.10)(react@19.2.4)(xstate@5.26.0)
      archiver: 7.0.1
      async-mutex: 0.5.0
      chalk: 4.1.2
      chokidar: 3.6.0
      classnames: 2.5.1
      color2k: 2.0.3
      configstore: 5.0.1
      console-table-printer: 2.15.0
      dataloader: 2.2.3
      date-fns: 4.1.0
      debug: 4.4.3(supports-color@8.1.1)
      esbuild: 0.27.2
      esbuild-register: 3.6.0(esbuild@0.27.2)
      execa: 2.1.0
      exif-component: 1.0.1
      fast-deep-equal: 3.1.3
      form-data: 4.0.5
      get-it: 8.7.0(debug@4.4.3)
      groq-js: 1.26.0
      gunzip-maybe: 1.4.2
      history: 5.3.0
      i18next: 23.16.8
      import-fresh: 3.3.1
      is-hotkey-esm: 1.0.0
      is-tar: 1.0.0
      isomorphic-dompurify: 2.26.0(bufferutil@4.1.0)(utf-8-validate@5.0.10)
      jsdom: 26.1.0(bufferutil@4.1.0)(utf-8-validate@5.0.10)
      jsdom-global: 3.0.2(jsdom@26.1.0(bufferutil@4.1.0)(utf-8-validate@5.0.10))
      json-lexer: 1.2.0
      json-reduce: 3.0.0
      json-stable-stringify: 1.3.0
      json5: 2.2.3
      lodash-es: 4.17.23
      log-symbols: 2.2.0
      mendoza: 3.0.8
      motion: 12.31.0(@emotion/is-prop-valid@1.4.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
      nano-pubsub: 3.0.0
      nanoid: 3.3.11
      node-html-parser: 6.1.13
      observable-callback: 1.0.3(rxjs@7.8.2)
      oneline: 1.0.4
      open: 8.4.2
      p-map: 7.0.4
      path-to-regexp: 6.3.0
      peek-stream: 1.1.3
      picomatch: 4.0.3
      pirates: 4.0.7
      player.style: 0.1.10(react@19.2.4)
      pluralize-esm: 9.0.5
      polished: 4.3.1
      preferred-pm: 4.1.1
      pretty-ms: 7.0.1
      quick-lru: 7.3.0
      raf: 3.4.1
      react: 19.2.4
      react-dom: 19.2.4(react@19.2.4)
      react-fast-compare: 3.2.2
      react-focus-lock: 2.13.7(@types/react@19.2.10)(react@19.2.4)
      react-i18next: 15.6.1(i18next@23.16.8)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3)
      react-is: 19.2.4
      react-refractor: 4.0.0(react@19.2.4)
      react-rx: 4.2.2(react@19.2.4)(rxjs@7.8.2)
      read-pkg-up: 7.0.1
      refractor: 5.0.0
      resolve-from: 5.0.0
      rimraf: 5.0.10
      rxjs: 7.8.2
      rxjs-exhaustmap-with-trailing: 2.1.1(rxjs@7.8.2)
      rxjs-mergemap-array: 0.1.0(rxjs@7.8.2)
      scroll-into-view-if-needed: 3.1.0
      scrollmirror: 1.2.4
      semver: 7.7.3
      shallow-equals: 1.0.0
      speakingurl: 14.0.1
      styled-components: 6.3.8(react-dom@19.2.4(react@19.2.4))(react@19.2.4)
      tar-fs: 2.1.4
      tar-stream: 3.1.7
      tinyglobby: 0.2.15
      urlpattern-polyfill: 10.1.0
      use-device-pixel-ratio: 1.1.2(react@19.2.4)
      use-hot-module-reload: 2.0.0(react@19.2.4)
      use-sync-external-store: 1.6.0(react@19.2.4)
      uuid: 11.1.0
      vite: 7.3.1(@types/node@24.10.9)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)
      web-vitals: 5.1.0
      which: 5.0.0
      xstate: 5.26.0
      yargs: 17.7.2
    transitivePeerDependencies:
      - '@emotion/is-prop-valid'
      - '@exodus/crypto'
      - '@swc/helpers'
      - '@types/node'
      - '@types/react'
      - '@types/react-dom'
      - babel-plugin-react-compiler
      - bare-abort-controller
      - bufferutil
      - canvas
      - immer
      - jiti
      - less
      - lightningcss
      - react-native
      - react-native-b4a
      - sass
      - sass-embedded
      - stylus
      - sugarss
      - supports-color
      - terser
      - tsx
      - typescript
      - utf-8-validate
      - vitest
      - yaml

Describe the solution you'd like
Review dependencies used in sanity and only make users pull in the minimum amount required to run next-sanity.

Describe alternatives you've considered
Ideally not use next-sanity

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