react
yarn 빌드시 path 경로 변경
최성헌
2018. 8. 31. 15:13
build 이휴 생성되는 html 파일에 설정되어 있는 경로를 보면 '/' 로 시작 하는 것으로 되어 있다.
contextPath나 테스트를 위해 기본 URL이 변경이 필요할 땐 적용하도록 하자.
package.json 파일에 homepage 속성을 추가한다.
예제
{
"name": "phone-book",
"version": "0.1.0",
"homepage": "./",
"private": true,
"dependencies": {
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "1.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}