motiondivision/motion

[BUG] React import errors in Cloudflare

bairdj opened this issue ยท 8 comments

1. Read the FAQs ๐Ÿ‘‡

2. Describe the bug

When migrating from "framer-motion" to "motion", build errors are encountered in Cloudflare wrangler related to React imports. This only occurs when using wrangler on Cloudflare - the build works as expected when building locally using Vite.

"../node_modules/motion/src/react.ts" for import "useInsertionEffect" suggests is resolving from react.ts rather than react package. This may be a Wrangler issue as it builds as expected on Vite, but framer-motion worked with the exact same configuration which suggests there may be an issue with some configuration in motion.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/devbox/yh6ynm

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Create a project using Remix Cloudflare template
  2. In a route, `import { motion } from "motion/react"
  3. npm run build
  4. npm run start
  5. Import error received
โžœ  workspace git:(main) โœ— npm run start

> start
> wrangler pages dev ./build/client


 โ›…๏ธ wrangler 3.91.0
-------------------

โ–ฒ [WARNING] No compatibility_date was specified. Using today's date: 2024-12-01.

  โฏโฏ Add one to your Wrangler configuration file: compatibility_date = "2024-12-01", or
  โฏโฏ Pass it in your terminal: wrangler pages dev [<DIRECTORY>] --compatibility-date=2024-12-01
  
  See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information.


โœ˜ [ERROR] Build failed with 88 errors:

  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs:1:9:
        1 โ”‚ import { useState, useLayoutEffect } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useLayoutEffect"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs:1:19:
        1 โ”‚ import { useState, useLayoutEffect } from 'react';
          โ•ต                    ~~~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useId"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs:4:9:
        4 โ”‚ import { useId, useRef, useContext, useInsertionEffect } from 'react';
          โ•ต          ~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs:4:16:
        4 โ”‚ import { useId, useRef, useContext, useInsertionEffect } from 'react';
          โ•ต                 ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs:4:24:
        4 โ”‚ import { useId, useRef, useContext, useInsertionEffect } from 'react';
          โ•ต                         ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useInsertionEffect"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs:4:36:
        4 โ”‚ import { useId, useRef, useContext, useInsertionEffect } from 'react';
          โ•ต                                     ~~~~~~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useId"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs:4:9:
        4 โ”‚ import { useId, useCallback, useMemo } from 'react';
          โ•ต          ~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useCallback"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs:4:16:
        4 โ”‚ import { useId, useCallback, useMemo } from 'react';
          โ•ต                 ~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs:4:29:
        4 โ”‚ import { useId, useCallback, useMemo } from 'react';
          โ•ต                              ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs:3:9:
        3 โ”‚ import { useMemo, useRef, useState, useContext } from 'react';
          โ•ต          ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs:3:18:
        3 โ”‚ import { useMemo, useRef, useState, useContext } from 'react';
          โ•ต                   ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs:3:26:
        3 โ”‚ import { useMemo, useRef, useState, useContext } from 'react';
          โ•ต                           ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs:3:36:
        3 โ”‚ import { useMemo, useRef, useState, useContext } from 'react';
          โ•ต                                     ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs:1:9:
        1 โ”‚ import { useContext, useId, useEffect, useCallback } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useId"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs:1:21:
        1 โ”‚ import { useContext, useId, useEffect, useCallback } from 'react';
          โ•ต                      ~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs:1:28:
        1 โ”‚ import { useContext, useId, useEffect, useCallback } from 'react';
          โ•ต                             ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useCallback"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs:1:39:
        1 โ”‚ import { useContext, useId, useEffect, useCallback } from 'react';
          โ•ต                                        ~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "Children"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs:1:9:
        1 โ”‚ import { Children, isValidElement } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "isValidElement"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs:1:19:
        1 โ”‚ import { Children, isValidElement } from 'react';
          โ•ต                    ~~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs:3:9:
        3 โ”‚ import { useContext, useRef, useMemo } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs:3:21:
        3 โ”‚ import { useContext, useRef, useMemo } from 'react';
          โ•ต                      ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs:3:29:
        3 โ”‚ import { useContext, useRef, useMemo } from 'react';
          โ•ต                              ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs:3:9:
        3 โ”‚ import { useState, useRef, useEffect } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs:3:19:
        3 โ”‚ import { useState, useRef, useEffect } from 'react';
          โ•ต                    ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs:3:27:
        3 โ”‚ import { useState, useRef, useEffect } from 'react';
          โ•ต                            ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs:3:9:
        3 โ”‚ import { useContext, useMemo } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs:3:21:
        3 โ”‚ import { useContext, useMemo } from 'react';
          โ•ต                      ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "forwardRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs:4:9:
        4 โ”‚ import { forwardRef, useRef, useEffect } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs:4:21:
        4 โ”‚ import { forwardRef, useRef, useEffect } from 'react';
          โ•ต                      ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs:4:29:
        4 โ”‚ import { forwardRef, useRef, useEffect } from 'react';
          โ•ต                              ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "forwardRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs:4:9:
        4 โ”‚ import { forwardRef, useContext } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs:4:21:
        4 โ”‚ import { forwardRef, useContext } from 'react';
          โ•ต                      ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs:1:9:
        1 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/LazyContext.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs:1:9:
        1 โ”‚ import { useContext, useMemo } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs:1:21:
        1 โ”‚ import { useContext, useMemo } from 'react';
          โ•ต                      ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/PresenceContext.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/ReorderContext.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs:2:9:
        2 โ”‚ import { createContext } from 'react';
          โ•ต          ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/events/use-dom-event.mjs:1:9:
        1 โ”‚ import { useEffect } from 'react';
          โ•ต          ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs:3:9:
        3 โ”‚ import { useContext, Component } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "Component"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs:3:21:
        3 โ”‚ import { useContext, Component } from 'react';
          โ•ต                      ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "forwardRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/index.mjs:3:9:
        3 โ”‚ import { forwardRef, useContext } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/index.mjs:3:21:
        3 โ”‚ import { forwardRef, useContext } from 'react';
          โ•ต                      ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useCallback"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs:1:9:
        1 โ”‚ import { useCallback } from 'react';
          โ•ต          ~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs:1:9:
        1 โ”‚ import { useContext, useRef, useInsertionEffect, useEffect } from '...
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs:1:21:
        1 โ”‚ import { useContext, useRef, useInsertionEffect, useEffect } from '...
          โ•ต                      ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useInsertionEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs:1:29:
        1 โ”‚ ... { useContext, useRef, useInsertionEffect, useEffect } from 'rea...
          โ•ต                           ~~~~~~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs:1:49:
        1 โ”‚ ...{ useContext, useRef, useInsertionEffect, useEffect } from 'react';
          โ•ต                                              ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs:1:9:
        1 โ”‚ import { useContext } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useCallback"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/projection/use-reset-projection.mjs:1:9:
        1 โ”‚ import { useCallback } from 'react';
          โ•ต          ~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "Fragment"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs:1:9:
        1 โ”‚ import { Fragment } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "Fragment"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/render/dom/use-render.mjs:1:9:
        1 โ”‚ import { Fragment, useMemo, createElement } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/render/dom/use-render.mjs:1:19:
        1 โ”‚ import { Fragment, useMemo, createElement } from 'react';
          โ•ต                    ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "createElement"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/render/dom/use-render.mjs:1:28:
        1 โ”‚ import { Fragment, useMemo, createElement } from 'react';
          โ•ต                             ~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/render/html/use-props.mjs:1:9:
        1 โ”‚ import { useMemo } from 'react';
          โ•ต          ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useMemo"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/render/svg/use-props.mjs:1:9:
        1 โ”‚ import { useMemo } from 'react';
          โ•ต          ~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs:1:9:
        1 โ”‚ import { useContext } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
  
  ../node_modules/motion/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs:1:9:
        1 โ”‚ import { useState } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs:1:9:
        1 โ”‚ import { useRef, useContext, useEffect } from 'react';
          โ•ต          ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs:1:17:
        1 โ”‚ import { useRef, useContext, useEffect } from 'react';
          โ•ต                  ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs:1:29:
        1 โ”‚ import { useRef, useContext, useEffect } from 'react';
          โ•ต                              ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-constant.mjs:1:9:
        1 โ”‚ import { useRef } from 'react';
          โ•ต          ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-cycle.mjs:1:9:
        1 โ”‚ import { useRef, useState, useCallback } from 'react';
          โ•ต          ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-cycle.mjs:1:17:
        1 โ”‚ import { useRef, useState, useCallback } from 'react';
          โ•ต                  ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useCallback"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-cycle.mjs:1:27:
        1 โ”‚ import { useRef, useState, useCallback } from 'react';
          โ•ต                            ~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-force-update.mjs:1:9:
        1 โ”‚ import { useState, useCallback } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useCallback"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-force-update.mjs:1:19:
        1 โ”‚ import { useState, useCallback } from 'react';
          โ•ต                    ~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-in-view.mjs:1:9:
        1 โ”‚ import { useState, useEffect } from 'react';
          โ•ต          ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-in-view.mjs:1:19:
        1 โ”‚ import { useState, useEffect } from 'react';
          โ•ต                    ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs:1:9:
        1 โ”‚ import { useRef, useEffect } from 'react';
          โ•ต          ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs:1:17:
        1 โ”‚ import { useRef, useEffect } from 'react';
          โ•ต                  ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-is-mounted.mjs:1:9:
        1 โ”‚ import { useRef } from 'react';
          โ•ต          ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useLayoutEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs:1:9:
        1 โ”‚ import { useLayoutEffect, useEffect } from 'react';
          โ•ต          ~~~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs:1:26:
        1 โ”‚ import { useLayoutEffect, useEffect } from 'react';
          โ•ต                           ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useInsertionEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs:1:9:
        1 โ”‚ import { useInsertionEffect } from 'react';
          โ•ต          ~~~~~~~~~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/utils/use-unmount-effect.mjs:1:9:
        1 โ”‚ import { useEffect } from 'react';
          โ•ต          ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs:5:9:
        5 โ”‚ import { useContext } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-motion-value.mjs:1:9:
        1 โ”‚ import { useContext, useState, useEffect } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useState"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-motion-value.mjs:1:21:
        1 โ”‚ import { useContext, useState, useEffect } from 'react';
          โ•ต                      ~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-motion-value.mjs:1:31:
        1 โ”‚ import { useContext, useState, useEffect } from 'react';
          โ•ต                                ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-scroll.mjs:3:9:
        3 โ”‚ import { useEffect } from 'react';
          โ•ต          ~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useContext"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-spring.mjs:1:9:
        1 โ”‚ import { useContext, useRef, useInsertionEffect } from 'react';
          โ•ต          ~~~~~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useRef"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-spring.mjs:1:21:
        1 โ”‚ import { useContext, useRef, useInsertionEffect } from 'react';
          โ•ต                      ~~~~~~
  
  
  โœ˜ [ERROR] No matching export in
  "../node_modules/motion/src/react.ts" for import "useInsertionEffect"
  
      ../node_modules/motion/dist/es/framer-motion/dist/es/value/use-spring.mjs:1:29:
        1 โ”‚ import { useContext, useRef, useInsertionEffect } from 'react';
          โ•ต                              ~~~~~~~~~~~~~~~~~~
  
  



โœ˜ [ERROR] Failed to build Functions at ./functions.

5. Expected behavior

Wrangler build works as expected.

If the import line is changed to `import { motion } from "framer-motion" it works as expected

6. Video or screenshots

Logs above

7. Environment details

See sandbox

There is the same thing in bun oven-sh/bun#15614, and I found out it's because of the tsconfig.json at root. The issue was from baseUrl and bun resolving react from first there, so I wouldn't be surprised if Cloudflare was doing something similar.

+1 same issue when trying to deploy to CF workers via react-router. Removing the baseUrl from the motion tsconfig.json when deploying seemed to temporarily fix this

Experiencing the same and using the framer-motion package instead doesn't have this issue.

Yea manually removing baseUrl in node_modules/motion/tsconfig.json lets me deploy to CF.

Also just saw that it's extending a tsconfig which isn't available when installed https://github.com/motiondivision/motion/blob/6cd8bda421eb6067412d589a66ee47bedefbd597/packages/motion/tsconfig.json#L2C5-L2C39

Should this tsconfig.json be in the npm package in the first place? (Been quite a while since I've published anything so not sure ๐Ÿ˜…)

@bairdj @CanRau can you verify if this still occurs with 11.14.4? As I believe the tsconfig.json is correctly excluded from the npm bundle now.

@mattgperry has been resolved. thank you

Awesome!

Was on 12.0.0-alpha.2 before, and yes 11.14.4 works ๐Ÿ‘Œ๐Ÿผ thank you ๐Ÿ™๐Ÿผ