• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

util/produce.js 에서 오류가 납니다

23.07.25 21:26 작성 조회수 283

0

npm run dev를 했는데

아래와 같은 오류가 뜨면서 실행이 안됩니다

어디서 문제가 있는 건가요?

 

util/produce.js 코드 내용

import { enableES5, produce } from 'immer';

export default (...args) => {
  enableES5();
  return produce(...args);
};

 

 

터미널 에러

> react-nodebird-front@1.0.0 dev

> next -p 3060

ready - started server on 0.0.0.0:3060, url: http://localhost:3060

event - compiled client and server successfully in 668 ms (1830 modules)

wait - compiling / (client and server)...

event - compiled client and server successfully in 1185 ms (4446 modules)

4. WrappedApp created new store with withRedux(NodeBird) { initialState: undefined, initialStateFromGSPorGSSR: undefined }

{}

wait - compiling /_error (client and server)...

error - util/produce.js (4:11) @ __WEBPACK_DEFAULT_EXPORT__

error - TypeError: (0 , immer__WEBPACK_IMPORTED_MODULE_0__.enableES5) is not a function

at __WEBPACK_DEFAULT_EXPORT__ (webpack-internal:///./util/produce.js:11:53)

at reducer (webpack-internal:///./reducers/user.js:115:106)

at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:476:24

at Array.forEach (<anonymous>)

at assertReducerShape (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:474:25)

at combineReducers (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:539:5)

at eval (webpack-internal:///./reducers/index.js:19:75) {

page: '/'

}

2 |

3 | export default (...args) => {

> 4 | enableES5();

| ^

5 | return produce(...args);

6 | };

event - compiled client and server successfully in 315 ms (4447 modules)

4. WrappedApp created new store with withRedux(NodeBird) { initialState: undefined, initialStateFromGSPorGSSR: undefined }

{}

TypeError: (0 , immer__WEBPACK_IMPORTED_MODULE_0__.enableES5) is not a function

at __WEBPACK_DEFAULT_EXPORT__ (webpack-internal:///./util/produce.js:11:53)

at reducer (webpack-internal:///./reducers/user.js:115:106)

at /Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:476:24

at Array.forEach (<anonymous>)

at assertReducerShape (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:474:25)

at combineReducers (/Users/hyeonyeongjeong/Documents/2023project/nodebird/prepare/front/node_modules/redux/lib/redux.js:539:5)

at eval (webpack-internal:///./reducers/index.js:19:75)

at processTicksAndRejections (node:internal/process/task_queues:96:5)

^C%

답변 1

답변을 작성해보세요.

0

immer는 지금 버전에서 es5를 지원하지 않을겁니다. enableEs5를 그냥 지우세요

정현영님의 프로필

정현영

질문자

2023.07.25

  • Since version 6, support for the fallback implementation has to be explicitly enabled by calling enableES5().

  • Version 10 drops the fallback implementation fully, and cannot be used in browsers / engines that don't support Proxy.

답변 감사합니다!

지우니까 바로 됬어요

검색 해 봤는데 혹시 이부분이

es5를 지원하지 않는다는 내용인가요?

'버전 10은 대체 구현을 완전히 삭제하고 프록시를 지원하지 않는 브라우저/엔진에서 사용할 수 없습니다.'

번역해보니까 이렇게 나오는데 무슨 뜻인가요?

 

네 버전10부터는 es5 브라우저에서는 안돌아간다는 것입니다.

정현영님의 프로필

정현영

질문자

2023.07.27

감사합니다!