작성완료

node_modules 내용 변경 후 유지 (patch-package)
패키지 설치 후 node_modules의 내용을 유지하기 위해 patch-package와 postinstall-postinstall을 설치하고, package.json에 postinstall 스크립트를 추가한 후, 내부 파일을 수정하고 패치를 생성하여 테스트하는 방법을 설명합니다.
1. 모듈 설치
npm install patch-package postinstall-postinstall --save-dev
yarn add patch-package postinstall-postinstall --dev
``
**
2. package.json에 postinstall 스크립트 추가**
``json
"scripts": {
"postinstall": "patch-package"
}
3. node_modules 내부 파일 수정 (예시: react-native)
// 예시
android {
namespace "com.test.my-react-native" // 🔧 이 줄을 직접 추가
...
}
4. 패치 생성 (예시: react-native)
npx patch-package react-native
5. 테스트
rm -rf node_modules && npm install
rm -rf node_modules && yarn