Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack scss 설정 질문 #88

Closed
SongChan-Gyu opened this issue Jan 6, 2019 · 1 comment
Closed

webpack scss 설정 질문 #88

SongChan-Gyu opened this issue Jan 6, 2019 · 1 comment
Labels
old 개정판에서 사라진 내용입니다.

Comments

@SongChan-Gyu
Copy link

제 create-recat-app project 에서는 webpack.config.dev.js가 없고 config 폴더안에 webpack.config.js로 해서
const getStyleLoaders = (cssOptions, preProcessor) => {
const loaders = [
isEnvDevelopment && require.resolve('style-loader'),
isEnvProduction && {
loader: MiniCssExtractPlugin.loader,
options: Object.assign(
{},
shouldUseRelativeAssetPaths ? { publicPath: '../../' } : undefined
),
},
{
loader: require.resolve('css-loader'),
options: cssOptions,
},
{
// Options for PostCSS as we reference these options twice
// Adds vendor prefixing based on your specified browser support in
// package.json
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
}),
],
sourceMap: isEnvProduction && shouldUseSourceMap,
},
},
].filter(Boolean);
if (preProcessor) {
loaders.push({
loader: require.resolve(preProcessor),
options: {
sourceMap: isEnvProduction && shouldUseSourceMap,
},
});
}
return loaders;
};
이런 형식으로 들어있는데 설정을 어떻게 해야할까요?
그리고 실제 호스팅 할때 설정을 webpack.config.prd.js 에서 변경을 해야한다고 적혀있는데 그건 어디에서 해야 할까요? 리액트도 처음이고 사전지식도 없는터라 이게 webpack 버전이 달라서 그런건가
이유를 잘 모르겠어서 질문드립니다. 환경은 윈도우입니다.

@meh9184
Copy link

meh9184 commented Jan 14, 2019

저도 요즘 리액트를 다루는 기술 책 보면서 공부하고있는데, velopert님 사이트 에서 설명해주신대로,, CRA의 V2 버전이 릴리즈 되면서 Sass 와 CSS Module 을 yarn eject 하지 않고 사용 할 수 있게 되었어요

혹시 지금 진행하고 계신 부분이 sass 스타일링 부분이시라면 별도의 컨피규레이션 없이도 사용 가능하네요!
자세한 설명은 velopert님 사이트 링크 가시면 언급돼있습니다.

@velopert velopert added the old 개정판에서 사라진 내용입니다. label Feb 9, 2020
@velopert velopert closed this as completed Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
old 개정판에서 사라진 내용입니다.
Projects
None yet
Development

No branches or pull requests

3 participants