# 이미지, 폰트 에셋 구성

## 1. 이미지 로더 설치

[url-loader](https://www.npmjs.com/package/url-loader), [file-loader](https://www.npmjs.com/package/file-loader), [@svgr/webpack](https://www.npmjs.com/package/@svgr/webpack) 패키지를  프로젝트에 설치합니다.

{% tabs %}
{% tab title="패키지 설치" %}

```bash
npm install url-loader file-loader @svgr/webpack -D
```

{% endtab %}
{% endtabs %}

## 2. 로더 / 플러그인 구성

`module`에 이미지 및 웹 폰트 로더(loader)를 구성합니다.

{% tabs %}
{% tab title="webpack.config.js" %}

```javascript
module.exports = (_env, argv) => {
  // ...
  return {
    // ...
    module: {
      rules: [
        // 이미지 로더
        {
          test: /\.(jpe?g|png|gif)$/i,
          use: [
            {
              loader: 'url-loader',
              options: {
                limit: 8192,
                name: 'assets/images/[name].[hash:8].[ext]',
              }
            }
          ]
        },
        // SVG 로더
        {
          test: /\.svg$/i,
          use: ['@svgr/webpack'],
        },
        // 웹폰트 로더
        {
          test: /\.(woff|woff2|eot|ttf|otf)$/i,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: 'assets/fonts/[name].[hash:8].[ext]',
              },
            },
          ],
        },
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yamoo9.gitbook.io/webpack/react/create-your-own-react-app/configure-images-fonts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
