Module parse error with @sanity/orderable-document-list plugin import

15 repliesLast updated: Nov 29, 2025

Hi! I am new to Sanity and adding some documentation to my site. I’d like to add the
@sanity/orderable-document-list
plugin, but get this error:
./node_modules/@sanity/orderable-document-list/node_modules/@sanity/ui/dist/index.esm.js
Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (61:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See <https://webpack.js.org/concepts#loaders>
Any help or insight appreciated! Thank you!
AI Update

This error typically happens when you're using the @sanity/orderable-document-list plugin in a Next.js project (or similar framework) that isn't configured to properly transpile the Sanity UI package. The error message about "sourceType: module" indicates that webpack is encountering ES modules but doesn't know how to handle them.

The most common fix is to add the Sanity packages to your Next.js transpilation configuration. In your next.config.js (or next.config.mjs), add the transpilePackages option:

/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['@sanity/ui', '@sanity/orderable-document-list']
}

module.exports = nextConfig

If you're using next.config.mjs:

/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['@sanity/ui', '@sanity/orderable-document-list']
}

export default nextConfig

This tells Next.js to process these packages through its build pipeline, converting the ES modules into a format that webpack can understand.

A few other things to check:

After making these changes, restart your development server completely. The error should be resolved and you'll be able to use the orderable-document-list plugin to add drag-and-drop ordering to your documents!

Show original thread
15 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions