# 네임스페이스와 모듈

## 네임스페이스 <a href="#namespace" id="namespace"></a>

네임스페이스는 JavaScript 객체를 사용해 범주를 생성하며 여러 파일로 나눠 개발 확장 할 수 있고, 연결 가능합니다. 네임스페이스를 구성하는 모든 의존성 파일을 HTML 페이지 `<script>` 요소를 사용해 웹 애플리케이션 코드를 구성하는 방법으로 사용될 수 있습니다.

다만, 대규모 애플리케이션 개발 시에 컴포넌트 의존성을 구별하기 어려울 수 있습니다.

## 모듈 <a href="#module" id="module"></a>

네임스페이스와 마찬가지로 모듈에 코드와 선언이 모두 포함될 수 있습니다. 가장 큰 차이점은 모듈 상단에 의존성을 선언 한다는 것입니다. 모듈을 활용하기 위해서는 모듈 로더 혹은 번들러가 필요합니다.

소규모 애플리케이션 개발일 경우 이 과정이 불필요하게 느껴질 수 있지만, **대규모 애플리케이션을 개발할 경우 장기적으로 모듈성, 유지관리 이점이 있습니다.** 참고로 Node.js 애플리케이션 개발에서는 모듈 방식을 기본으로 하며, 코드를 구조화를 위한 방법으로 권장합니다.


---

# 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/typescript/namespace-vs-module.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.
