motion: [BUG] 5.0 Failed to compile with create-react-app
Failed to compile.
./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
Can't import the named export 'Children' from non EcmaScript module (only default export is available)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 68
- Comments: 48 (1 by maintainers)
Commits related to this issue
- Downgrade framer-motion: https://github.com/framer/motion/issues/1307 — committed to last-rev-llc/lastrev-libraries by maxtechera 3 years ago
- Add AnimationContext to ContentModule (#295) * Fix-Test disable failing test * Trim down amount of Carousel percy snapshots * Add AnimationContext to ContentModule * Update storybook webpack... — committed to last-rev-llc/lastrev-libraries by maxtechera 3 years ago
- fix: allow framer-motion v5 to be used with CRA see https://github.com/framer/motion/issues/1307 — committed to opengovsg/FormSG by karrui 3 years ago
- chore(v2): update npm packages to their latest versions (except storybook) (#3168) * chore: run `npx npm-check-updates -u` to update all packages to latest except eslint, since we are still locked... — committed to opengovsg/FormSG by karrui 3 years ago
- [broken] upgrades framer-motion to support react 17 https://github.com/framer/motion/blob/main/CHANGELOG.md what's broken looks like it might be https://github.com/framer/motion/issues/1307 — committed to dimitropoulos/insomnia by dimitropoulos 2 years ago
- [broken] upgrades framer-motion to support react 17 https://github.com/framer/motion/blob/main/CHANGELOG.md what's broken looks like it might be https://github.com/framer/motion/issues/1307 — committed to dimitropoulos/insomnia by dimitropoulos 2 years ago
- [broken] upgrades framer-motion to support react 17 https://github.com/framer/motion/blob/main/CHANGELOG.md what's broken looks like it might be https://github.com/framer/motion/issues/1307 — committed to dimitropoulos/insomnia by dimitropoulos 2 years ago
- #8.1 Installation # ****#8.0 Introduction**** ## 개요 - 이번 섹션에서는 Framer Motion을 써서 애니메이션을 만드는 법에 대해 학습한다. ## Framer Motion [Production-Ready Animation Library for React | Framer Motion](https://www... — committed to clean-teach/study-nomadcoders-react-masterclass-animations by clean-teach 2 years ago
@justrealmilk I added the following to
craco.config.jsand it appears to work.I’m using NextJS fwiw and fixed the error by following @j-borg’s link and just wanted to make what the solution was explicit because webpack gives me nightmares and I feel like any time I’m fortunate enough to happen across a tip that works, I am eternally grateful.
In my project, I’ve got a
.storybookdirectory at the root.Within that directory, I have a file at
.storybook/main.js. I just added the entry for thewebpackFinalproperty of that file, so now it looks like so (the other stuff was already there)I get the same error using this via Next.js
@AndreaEsposit You can still use
4.1.17, you just won’t get the drag-to-reorder components.https://www.framer.com/docs/guide-upgrade/#%23esm-and-create-react-app https://github.com/facebook/create-react-app/issues/10356
We are looking at a fix but it might be in CRA. Let’s track it in this ticket
I am getting this error when trying to run storybook
6.3.12and framer5.2.1I was able to fix it by patching CRA https://github.com/formatjs/formatjs/issues/1395#issuecomment-518823361
After testing a bit it seems that the issue is with how CRA handles ESM dependencies and more particularly transitive dependencies are not handled correctly it seems. There is also an outstanding issue with CRA about this https://github.com/facebook/create-react-app/issues/10356.
Options:
This is ‘fixed’/doesn’t break in the next version of CRA which you can try today (https://github.com/facebook/create-react-app/discussions/11278) take note though its still in alpha.
You can patch CRA to get around the issue as described in a number of tickets from other libraries
BTW: the issue exists with Storybook@6.3.12 too, can be overcome using
webpackFinaland https://github.com/framer/motion/issues/1307#issuecomment-953621828Update your react scripts,
npm install react-scripts@latestI believe this will fix CRA https://github.com/facebook/create-react-app/releases/tag/v5.0.0
This worked for me. Also on a NextJS app. Thanks @github-user001 🙏🏾
Lol I broke my entire project trying to add framer-motion. My advice: don’t bother. Get good at CSS animations, the clowns at framer motion have no clue what they’re doing and their stuff only works in their perfect little sandbox display online.
this fixes it:
I still have this issue with
@chakra-ui/react@1.7.3,framer-motion@5.6.0,storybook-react@6.4.14and@chakra-ui/storybook-addon@1.0.1this works for me as well
I don’t even want to use framer but chakra-ui seems to depend on it, so CRA broke chakra-ui it seems. and that bug is from 2019. https://github.com/formatjs/formatjs/issues/1395#issuecomment-518823361
do we really need to battle with craco to get any progress?
Same here when running a Storybook build. @jafin 's solution worked for us though. Added the
mjsrule to thewebpackFinalconfig in Storybook https://storybook.js.org/docs/react/configure/webpack#extending-storybooks-webpack-configYes - Craco version 6.3.0 and Framer Motion 5.2.0
It worked for me
I also have this same issue
@thesmashten framer-motion is an awesome project and follows the latest standards in ESM. If you can’t get it to run, look at yourself
We aren’t using
react-scripts@bluekingnfxHaving this issue on a Webpack v4.43.x (no CRA) install, none of the fixes appear to work besides downgrading to v4.1.x . Perhaps we shouldn’t close this issue until a new version of framer-motion arrives which solves this issue without requiring patches/updates to other tooling?
Getting the same issue when installed with framer-motion@5.3.3.
To solve this issue and work without error, it is recommended to install framer-motion@4.1.17.
Check this link: https://www.framer.com/docs/guide-upgrade/##esm-and-create-react-app
Having same issue
I have a more complex CRACO config. For anyone using a configure function, this is it
Weirdly didn’t work for me
me too facing the same