sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.33k stars 430 forks source link

Framer motion export errors from sanity ui during next build. #4239

Open juvoni opened 1 year ago

juvoni commented 1 year ago

Describe the bug When building a nextjs project with content powered by sanity, there build errors that trace to sanity UI.

Which versions of Sanity are you using?

@sanity/cli (global)  3.5.1 (up to date)
@sanity/image-url     1.0.2 (up to date)
@sanity/vision        3.5.1 (up to date)
sanity                3.5.1 (up to date)

What operating system are you using?: macOS Ventura 13

Which versions of Node.js / npm are you running? npm: 9.6.0 node: v16.13.0

Build Error

> build
> next build

info  - Loaded env from /Users/...
info  - Loaded env from /Users/...
warn  - You have enabled experimental features (appDir, mdxRs, serverComponentsExternalPackages) in next.config.mjs.
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback

info  - Creating an optimized production build
Failed to compile.

./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
Attempted import error: 'isCSSVariableToken' is not exported from './is-css-variable.mjs' (imported as 'isCSSVariableToken').

Import trace for requested module:
./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs
./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs
./node_modules/framer-motion/dist/es/motion/features/drag.mjs
./node_modules/framer-motion/dist/es/render/dom/motion.mjs
./node_modules/framer-motion/dist/es/index.mjs
./node_modules/@sanity/ui/dist/index.esm.js
./node_modules/sanity/lib/index.esm.js
./sanity.config.ts
./app/studio/[[...index]]/page.tsx

./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
Attempted import error: 'isCSSVariableToken' is not exported from './is-css-variable.mjs' (imported as 'isCSSVariableToken').

Import trace for requested module:
./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs
./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs
./node_modules/framer-motion/dist/es/motion/features/drag.mjs
./node_modules/framer-motion/dist/es/render/dom/motion.mjs
./node_modules/framer-motion/dist/es/index.mjs
./node_modules/@sanity/ui/dist/index.esm.js
./node_modules/sanity/lib/index.esm.js
./sanity.config.ts
./app/studio/[[...index]]/page.tsx

Additional context

My application runs fine in dev mode and I am able to use studio. Things just break down when trying to build.

rexxars commented 1 year ago

Having trouble reproducing this, could you provide a minimal reproduction case?