REACT/ERROR LOG

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.

인텔로퍼 2023. 2. 28. 09:26
반응형

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.

 

This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

- add a fallback 'resolve.fallback: { "timers": require.resolve("timers-browserify") }'

- install 'timers-browserify'

If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "timers": false }

 

 

이 오류는 웹팩이 Node.js의 핵심 모듈 중 하나인 timers를 찾을 수 없어서 발생하는 것입니다.

 

timers-browserify 모듈 설치 및 웹팩 설정 수정

 

해당 오류 메시지에 따르면, timers-browserify 모듈을 설치하고 웹팩 설정 파일에서 다음과 같이 resolve.fallback 속성을 추가해야 합니다:

// webpack.config.js
module.exports = {
  // ...
  resolve: {
    fallback: {
      timers: require.resolve('timers-browserify')
    }
  }
};
반응형