-
카테고리
-
세부 분야
프론트엔드
-
해결 여부
미해결
axios 1.1.2 버전 issue ( SyntaxError: Cannot use import statement outside a module)
22.10.28 21:31 작성 조회수 1.64k
5
혹시나 에러가 나신다면,
package.json폴더에
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!axios)/\"",
"eject": "react-scripts eject"
},
로 변경 후 test를 종료 후 재 실행시키면 됩니다.
방법은 test에서 직접 스크립트 수정하거나 jest.config.js파일을 만들어 moduleNameMapper을 사용하시면 됩니다!
참고
https://stackoverflow.com/questions/73958968/cannot-use-import-statement-outside-a-module-with-axios
https://jestjs.io/docs/configuration#modulenamemapper-objectstring-string--arraystring
답변을 작성해보세요.
0
0
0
0
0
답변 5