Open SoYoung210 opened 5 years ago
폴더 위치마다 style-loader를 다르게 사용하고 싶을때.
ex : bar-chart에서는 localIndentName없이, 다른 곳에선 있게. 이렇게 해야 styles.wrap 형태로 사용 가능하고, 클래스네임의 중복을 막을 수 있다.
bar-chart
styles.wrap
{ test: /\.p?css$/, include: [/bar-chart/, /line-chart/], use: [ 'style-loader', { loader: 'css-loader', options: { sourceMap: true, }, }, { loader: 'postcss-loader', }, ], }, { test: /\.p?css$/, exclude: [/node_modules/, /bar-chart/, /line-chart/], use: [ 'style-loader', { loader: 'css-loader', options: { sourceMap: true, modules: { localIdentName: '[local]_[hash:base64:5]', }, }, }, { loader: 'postcss-loader', }, ], },
exclude옵션을 추가했다면 추가적으로 include 옵션으로 핸들링 해주어야 빌드된다.
Desc
폴더 위치마다 style-loader를 다르게 사용하고 싶을때.
exclude옵션을 추가했다면 추가적으로 include 옵션으로 핸들링 해주어야 빌드된다.