하나의 node_modules로 CRA를 관리해서 front 디렉토리를 생성한다. #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CRA는 설치한 특정 root에서만 동작하게 webpack으로 설정이 되어 있다. 만약 우리가 특정 디렉토리에서 동작하게 하기위해서는 본래에는 webpack을 가지고 사용해야하 지만 현재 CRA를 기준으로 동작할 수 있게 코드를 구현하려 한다. 따라 craco와 같은 override를 할 수 있는 라이브러리를 사용해서 CRA의 webpack 설정을 변경 하였다. 내가 설정한 craco는 다음과 같다.
여기서
appSrc
는 front/src로 src 디렉토리를 설정하고appIndexJs
front/src/index.js로 진입 파일 경로를 설정,appHtml
은 front/public/index.html로 index.html 경로를 설정한다. 여기서 해당 path 객체 이름은 임의로 설정된 것이 아니라 기존 React에서 설정된 webpack의 이름을 사용한 것이기 때문에 변경하면 안된다. 따라서 전체 적인 디렉토리 구조는 다음과 같다.그렇다면 mono-repo인가?
앞으로의 다양한 라이브러리를 설치할 때 루트에서 설정하고 이를 내부로 설정할 수 있도록 하면 될 것이다. 특히, eslint같은 경우 extned를 사용해서 규칙을 정해볼 예정이다.