Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LazyMotion is not working in motion@^12.4.3 #3091

Open
EmilNordling opened this issue Feb 27, 2025 · 0 comments
Open

[BUG] LazyMotion is not working in motion@^12.4.3 #3091

EmilNordling opened this issue Feb 27, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@EmilNordling
Copy link

Describe the bug

Hi. I've stumbled into LazyMotion not work when moving from framer-motion 12.0.0-alpha.1 to motion 12.4.3 (Issue is still present in 12.4.7), and it's unclear why. We have been using the mini variant before the m was moved into its own dist folder. Seems like something how it's being now imported causes issues?

From the docs this example should work:

import { LazyMotion, domAnimation } from "motion/react"

// Load only the domAnimation package
function App({ children }) {
  return (
    <LazyMotion features={domAnimation}>
      {children}
    </LazyMotion>
  )
}

But after swapping the m imports to import * as m from "motion/react-m";, it'll not work, see the CodeSandbox example.

I believe a clue is that there's some modules being mismatched in the final bundle. If you take a look into the "expected.tsx" file, you'll see that TS is not super happy with the MotionStyle and MotionValue types. They are incompatible with the imports from motion/react, and this might be because some symbol reference is mismatched?

The example in the CodeSandbox seems like it should be valid given that the example in the docs is not working.

IMPORTANT: Provide a CodeSandbox reproduction of the bug

👉 https://codesandbox.io/p/sandbox/s9k25c

Steps to reproduce

  1. Go to sandbox.
  2. You'll see three examples of code that is expected to work, but only two does
  3. The first one is using import * as m from "motion/react-m"; and is not working.

Expected behavior

The LazyMotion should load the features correctly.

Video or screenshots

Environment details

@EmilNordling EmilNordling added the bug Something isn't working label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant