inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[리뉴얼] React로 NodeBird SNS 만들기

antd 커스터마이징

403

gheemddl

작성한 질문수 8

0

antd 홈페이지에 docs에서 coustomize theme의 예제를 보고 antd를 커스터마이징하려고 하는데

1 webpack.config.js가 next에서 next.config.js인가요?

2.next.config.js 설정을 어떻게 해야 하나요?

3 .babelrc에서도 따로 설정해야 되는 것이 있나요?

공식문서를 봐도 이해가 잘 안가서 질문드립니다

react express redux nodejs Next.js

답변 3

0

제로초(조현영)

lessLoaderOptions는 공식문서에서 확인할 수 없는 부분이긴 한데 웹팩 설정에 넣기보다는 compress 아래에 넣어주시는 게 맞을 것 같습니다.

요즘은 설정이 여러 개 있는 경우 next-compose-plugins을 써서 각각 설정하곤 합니다.

0

castinglife

저도 궁금했던 부분인데.. 

아래 처럼 설정을 추가해주면 될까요?

// 두가지를 다 사용할수 있다고 합니다. [ @zeit/next-sass는 기본 지원 ]

npm i less sass @zeit/next-less

next.config.js


const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
});

const withLess = require('@zeit/next-less');

//  노드에 .less 파일이 필요한 경우 오류 방지
if (typeof require !== 'undefined') {
  require.extensions['.less'] = file => {};
}

module.exports = withBundleAnalyzer(withless({
  compress: true,
  webpack(config, { webpack }) {
    const prod = process.env.NODE_ENV === 'production';
    return {
      ...config,

       lessLoaderOptions: {
            javascriptEnabled: true,
       },

      mode: prod ? 'production' : 'development',
      devtool: prod ? 'hidden-source-map' : 'eval',
      plugins: [
        ...config.plugins,
        new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /^\.\/ko$/),
      ],
    };
  },
}));




_app.js


import React from 'react';
import PropTypes from 'prop-types';
import Head from 'next/head';
// import 'antd/dist/antd.css';
import '../css/antd.less';

import wrapper from '../store/configureStore';

const NodeBird = ({ Component }) => (
  <>
    <Head>
      <meta charSet="utf-8" />
      <title>NodeBird</title>
    </Head>
    <Component />
  </>
);

NodeBird.propTypes = {
  Component: PropTypes.elementType.isRequired,
};

export default wrapper.withRedux(NodeBird);







/css/antd.less

@import '~antd/dist/antd.less';
@primary-color: #c02428;


0

제로초(조현영)

1. 다른 개념입니다. 단, next에서는 webpack config를 next config 안에 설정합니다.

2. 6강에서 next.config.js 설정하는 강좌까지 다 보신 후 다시 질문해주시면 좋을 것 같습니다. 그 때 antd에 어떤 부분이 적용하기 어려운지 알려주시면 됩니다.

https://github.com/ZeroCho/react-nodebird/blob/master/ch7/front/next.config.js

3. 바벨(.babelrc)도 원래는 따로이지만 next안에서 설정할 수 있습니다.

넥스트 버젼 질문

0

77

2

로그인시 401 Unauthorized 오류가 뜹니다

0

89

1

무한 스크롤 중 스크롤 튐 현상

0

175

1

특정 페이지 접근을 막고 싶을 때

0

103

2

createGlobalStyle의 위치와 영향범위

0

96

2

인라인 스타일 리렌더링 관련

0

91

2

vsc 에서 npm init 설치시 오류

0

146

2

nextjs 15버전 사용 가능할까요?

0

158

1

화면 새로고침 문의

0

121

1

RTK에서 draft, state 차이가 있나요?

0

153

2

Next 14 사용해도 될까요?

0

452

1

next, node 버전 / 폴더 구조 질문 드립니다.

0

349

1

url 오류 질문있습니다

0

211

1

ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out

0

372

1

sudo certbot --nginx 에러

0

1274

2

Minified React error 콘솔에러 (hydrate)

0

469

1

카카오 공유했을 때 이전에 작성했던 글이 나오는 버그

0

247

1

프론트서버 배포 후 EADDRINUSE에러 발생

0

327

1

npm run build 에러

0

518

1

front 서버 npm run build 중에 발생한 에러들

0

381

1

서버 실행하고 브라우저로 들어갔을때 404에러

0

338

2

css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.

0

287

1

팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.

0

237

2

해시태그 검색에서 throttle에 관해 질문있습니다.

0

201

1