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: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
fallback:{ "path": require.resolve("path-browserify") }
해결 링크 : 여기 에서 확인 가능하다
node_modules > react-scripts > config> webpack.config.js
fallback:{ "path": require.resolve("path-browserify") }
resolve: {
// This allows you to set a fallback for where webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebook/create-react-app/issues/253
(여기에 적자)
fallback:{ "path": require.resolve("path-browserify") },
...(중략)...
(여기까지 resolve 부분)
}
https://www.npmjs.com/package/path-browserify
리액트-타입스크립트 일 경우,
타입정보도 설치/적용해줘야 할꺼 같아 관련 자료를 한번에 볼 수 있도록, 링크를 남긴다.
npm i path-browserify
https://www.npmjs.com/package/path-browserify
npm i @types/path-browserify