React & React Native
React Sass 적용하기 , Sass 적용이 안될때
클라인STR
2019. 5. 2. 13:35
React 프로젝트에서 node-sass를 설치하고 @import 로 변수를 참조하였는데 scss가 동작하지 않았다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | { "name": "person-list2", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.8.6", "react-dom": "^16.8.6", "react-scripts": "0.9.x" }, "devDependencies": {}, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" } } | cs |
[변경전 package.json]
package.json 파일에서 react-scripts 버전을 2.0.3으로 변경하고 npm install을 다시 실행해줍니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | { "name": "city-tours", "version": "0.1.0", "private": true, "dependencies": { "node-sass": "^4.12.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-scripts": "2.0.3" }, "devDependencies": {}, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } | cs |
[변경된 package.json]
참고 : https://reactjs.org/blog/2018/10/01/create-react-app-v2.html