-
Notifications
You must be signed in to change notification settings - Fork 788
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] 5.0 Failed to compile with create-react-app #1307
Comments
Got the same exact problem here! I think it's the |
https://www.framer.com/docs/guide-upgrade/#%23esm-and-create-react-app We are looking at a fix but it might be in CRA. Let’s track it in this ticket |
Having same issue |
I was able to fix it by patching CRA |
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 facebook/create-react-app#10356. Options:
|
So as of now, the only solution to even be able to use framer-motion is to temper with CRA(if you are using CRA)?. Thant's a bummer, means that I can't use this library. |
Thank you guys for looking into this! @jwfwessels have you tried CRA5? |
@AndreaEsposit You can still use |
BTW: the issue exists with Storybook@6.3.12 too, can be overcome using |
Having the same issue here. |
Tried to configure a work around using CRACO and failed soooo back to 4.* |
my setup as asked, was just a fresh project setup: |
@justrealmilk I added the following to module.exports = {
webpack: {
configure: {
module: {
rules: [
{
type: 'javascript/auto',
test: /\.mjs$/,
include: /node_modules/,
},
],
},
},
},
} |
I get the same error using this via Next.js |
I also have this same issue |
me too facing the same |
same problem. Is there no way to fix it without downgrading framer-motion? |
Weirdly didn't work for me |
It worked for me |
@Solo-Digital Did you already have craco installed? |
Yes - Craco version 6.3.0 and Framer Motion 5.2.0 |
I am getting this error when trying to run storybook |
Same here when running a Storybook build. @jafin 's solution worked for us though. Added the |
…book) (#3168) * chore: run `npx npm-check-updates -u` to update all packages to latest except eslint, since we are still locked to v7 until cra supports it * lint: run lint fix * fix: allow framer-motion v5 to be used with CRA see framer/motion#1307 * fix: type breaking change in msw 0.36.0 see https://github.com/mswjs/msw/releases/tag/v0.36.0 * fix: rhf regression where last ref is focused instead of first need to now only assign first ref in array-like fields such as Rating field with options, or radio fields. * fix(TableFieldStories): type error * fix(Radio): infinite loop/crash on dependent radio input this was introduced in 7.14 or earlier (did not go back further to check). Suspect infinite validation loop. no clue on why it happens, just that it happens, unfortunately. However, seems to be fixed by adding dependent validation, a new feature in 7.14. * feat(Checkbox): use dependent field validation introduced in rhf7.14 * fix(PublicFormPageStory): add chromatic.pauseAnimationAtEnd prop prevent animation from hiding start page title
i have same issue with my CRA and i got solution from |
I believe this will fix CRA https://github.com/facebook/create-react-app/releases/tag/v5.0.0 |
Working with CRA 5 |
I still have this issue with |
Having 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? |
Update your react scripts, |
https://github.com/framer/motion/blob/main/CHANGELOG.md what's broken looks like it might be framer/motion#1307
https://github.com/framer/motion/blob/main/CHANGELOG.md what's broken looks like it might be framer/motion#1307
https://github.com/framer/motion/blob/main/CHANGELOG.md what's broken looks like it might be framer/motion#1307
We aren't using |
this fixes it:
|
# ****#8.0 Introduction**** ## 개요 - 이번 섹션에서는 Framer Motion을 써서 애니메이션을 만드는 법에 대해 학습한다. ## Framer Motion [Production-Ready Animation Library for React | Framer Motion](https://www.framer.com/motion/) - `ReactJS` 용 라이브러리 - 애니메이션을 쉽게 만들 수 있다. - Pose 라는 라이브러리에서 시작됐다. - [Framer](https://www.framer.com/)는 디자이너를 위해 프로토타입을 만들어주는 회사이다. - Framer Motion 라이브러리는 Framer에서 만들었다. # ****#8.1 Installation**** ## 목표 - 프로젝트에 Framer Motion 을 설치해본다. - Framer Motion 을 사용해서 애니메이션을 만들어 본다. ## 사용법 [Introduction | Framer for Developers](https://www.framer.com/docs/introduction/#quick-start) 1. `npm install framer-motion` 설치 - create-react-app Version 4 이하에서는 에러가 발생 할 것이다. → [Ecma Script Module 을 허용해야 한다.](https://www.notion.so/08-ANIMATIONS-d7c84838163c42e9980adba335f04f14) - create-react-app Version 5에서는 Ecma Script Module를 허용하기 때문에 해당 에러가 발생하지 않는다. 2. `import { motion } from "framer-motion"` 불러오기 3. `[<motion.div />` 컴포넌트](https://www.framer.com/docs/introduction/##the-motion-component) - Framer Motion 을 사용하기 위해서 일반 HTML Element를 사용 할 수는 없다. → Framer Motion이 제공하는 `motion` 패키지를 통해서 컴포넌트를 생성 한다. ### `[craco](https://github.com/dilanx/craco)` - create-react-app 의 설정사항을 **O**verride(무시) 해주는 라이브러리 - 사용법 1. `npm i -D @craco/craco` 설치 2. `craco.config.js` 파일 생성 - `package.json` 과 같은 단계에 위치 3. 해당 파일 설정이 필요한 곳에서 제공하는 문서를 따라서 `craco.config.js` 작성 - 예 : [framer/motion#1307 (comment) 4. `package.json` 의 script 명령어 수정 ```json "scripts": { ~~- "start": "react-scripts start"~~ **+ "start": "craco start"** ~~- "build": "react-scripts build"~~ **+ "build": "craco build"** ~~- "test": "react-scripts test"~~ **+ "test": "craco test"** } ```
Thanks. This solves my problem in nextjs project. |
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. |
@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 |
The text was updated successfully, but these errors were encountered: