inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

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

커스텀 웹팩과 bundle-analyzer

next.config.js 에러 질문입니다

해결된 질문

849

1ncursio

작성한 질문수 5

0

이번에 next + antd 로 진행하다가 antd customize theme를 써보고싶어져서

https://ant.design/docs/react/customize-theme#Customize-in-webpack

여기에 나와있는대로 웹팩 설정을

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

module.exports = withBundleAnalyzer({
  compress: true,
  webpack(config, { webpack }) {
    const prod = process.env.NODE_ENV === 'production';
    config.module.rules.push({
      test: /\.less$/,
      use: [
        {
          loader: 'style-loader',
        },
        {
          loader: 'css-loader', // translates CSS into CommonJS
        },
        {
          loader: 'less-loader', // compiles Less to CSS
          options: {
            lessOptions: {
              // If you are using less-loader@5 please spread the lessOptions to options directly
              modifyVars: {
                'primary-color': '#1DA57A',
                'link-color': '#1DA57A',
                'border-radius-base': '2px',
              },
              javascriptEnabled: true,
            },
          },
        },
      ],
    });

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

이렇게 기존에서 less 설정만 추가했습니다.

그런데 

> next -p 3080

Browserslist: caniuse-lite is outdated. Please run:

npx browserslist@latest --update-db

ready - started server on http://localhost:3080

Warning: Reverting webpack devtool to 'inline-source-map'.

Changing the webpack devtool in development mode will cause severe performance regressions.

Read more: https://err.sh/next.js/improper-devtool

Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.

See here for more info: https://err.sh/next.js/built-in-css-disabled

info  - Using external babel configuration from E:\programming\nodejs\utopia\client\.babelrc

error - ./node_modules/antd/dist/antd.css 13:6

Module parse failed: Unexpected token (13:6)

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

| /* stylelint-disable */

| /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */

> [class^=ant-]::-ms-clear,

| [class*= ant-]::-ms-clear,

| [class^=ant-] input::-ms-clear,

이런 오류가 뜹니다. custom css configuration 을  해서 built in css support가 중단되었다고하는거 같은데, 해당 링크에 들어가보면 외부 css 관련 플러그인을 사용했을때 뜰 수 있다라고 하는데 그 상황은 아닌거같고요.

혹시 어떻게 해야 웹팩 오류가 안나게 설정을 할 수 있을까요?

redux react express nodejs Next.js

답변 1

0

1ncursio

해결했습니다. less-loader에 jsEnabled가 deprecated 되었다네요. 다른 방식으로 적용했습니다

넥스트 버젼 질문

0

75

2

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

0

88

1

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

0

172

1

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

0

103

2

createGlobalStyle의 위치와 영향범위

0

95

2

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

0

90

2

vsc 에서 npm init 설치시 오류

0

146

2

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

0

158

1

화면 새로고침 문의

0

120

1

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

0

152

2

Next 14 사용해도 될까요?

0

452

1

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

0

348

1

url 오류 질문있습니다

0

211

1

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

0

372

1

sudo certbot --nginx 에러

0

1271

2

Minified React error 콘솔에러 (hydrate)

0

469

1

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

0

246

1

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

0

325

1

npm run build 에러

0

518

1

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

0

381

1

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

0

336

2

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

0

284

1

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

0

236

2

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

0

200

1