| 문제 상황
react에 antd를 이용하여 스타일을 적용하던 중 react가 업데이트 되면서 기존의 style이 제대로 적용되지 않는 문제가 발생했다.
1. 에러 코드
WARNING in ./node_modules/antd/dist/antd.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/antd/dist/antd.css)
[1] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
[1] Failed to parse source map: 'webpack://antd/./components/config-provider/style/index.less' URL is not supported
[1]
[1] WARNING in ./node_modules/antd/dist/antd.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/antd/dist/antd.css)
[1] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
[1] Failed to parse source map: 'webpack://antd/./components/icon/style/index.less' URL is not supported
[1]
[1] WARNING in ./node_modules/antd/dist/antd.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/antd/dist/antd.css)
[1] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
[1] Failed to parse source map: 'webpack://antd/./components/locale-provider/style/index.less' URL is not supported
[1]
[1] WARNING in ./node_modules/antd/dist/antd.css (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[5].use[2]!./node_modules/source-map-loader/dist/cjs.js!./node_modules/antd/dist/antd.css)
[1] Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
[1] Failed to parse source map: 'webpack://antd/./components/time-picker/style/index.less' URL is not supportt supported
| 해결 방법
방법 1. index.js의 코드 변경
// 기존 코드
import 'antd/dist/antd.css'
// 변경 코드
import 'antd/dist/antd.min.css'
방법 2. env에 'GENERATE_SOURCEMAP=false' 속성 추가
GENERATE_SOURCEMAP=false
| 참고 사이트
https://stackoverflow.com/questions/71500112/antd-source-map-not-supported-in-react
반응형