Skip to content

Commit 19a4fbe

Browse files
authored
Merge branch 'main' into v6
2 parents 88ef3c5 + e4858f6 commit 19a4fbe

File tree

9 files changed

+326
-104
lines changed

9 files changed

+326
-104
lines changed

src/content/docs/ko/guides/content-collections.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ const { Content, headings } = await render(entry);
418418
<Content />
419419
```
420420

421+
<ReadMore>MDX 항목을 다룰 때, [사용자 정의 컴포넌트를 `<Content />`에 전달](/ko/guides/integrations-guide/mdx/#components를-mdx-콘텐츠로-전달하기)하여 HTML 요소를 사용자 정의 대안으로 대체할 수도 있습니다.</ReadMore>
422+
421423
#### 콘텐츠를 props로 전달
422424

423425
컴포넌트는 컬렉션 항목 전체를 prop으로 전달할 수도 있습니다.

src/content/docs/ko/guides/deploy/cloudflare.mdx

Lines changed: 143 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ i18nReady: true
99
import ReadMore from '~/components/ReadMore.astro';
1010
import { Steps } from '@astrojs/starlight/components';
1111
import StaticSsrTabs from '~/components/tabs/StaticSsrTabs.astro';
12+
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
1213

1314
프런트엔드 정적 자산과 백엔드 API를 포함한 풀스택 애플리케이션뿐만 아니라 요청 시 렌더링되는 사이트까지 [Cloudflare Workers](https://developers.cloudflare.com/workers/static-assets/)[Cloudflare Pages](https://pages.cloudflare.com/)에 배포할 수 있습니다.
1415

@@ -45,46 +46,53 @@ Astro 프로젝트에서 [Cloudflare 런타임을 사용하는 방법](/ko/guide
4546

4647
이 명령어는 어댑터를 설치하고 `astro.config.mjs` 파일에 필요한 변경 사항을 한 번에 적용합니다.
4748

48-
```bash
49+
<PackageManagerTabs>
50+
<Fragment slot="npm">
51+
```sh
4952
npx astro add cloudflare
5053
```
51-
52-
그런 다음 `public/` 폴더에 `.assetsignore` 파일을 만들고 다음 줄을 추가하세요.
53-
```txt title="public/.assetsignore"
54-
_worker.js
55-
_routes.json
54+
</Fragment>
55+
<Fragment slot="pnpm">
56+
```sh
57+
pnpm astro add cloudflare
58+
```
59+
</Fragment>
60+
<Fragment slot="yarn">
61+
```sh
62+
yarn astro add cloudflare
5663
```
64+
</Fragment>
65+
</PackageManagerTabs>
5766

5867
<ReadMore>[Astro의 요청 시 렌더링](/ko/guides/on-demand-rendering/)에 대해 더 자세히 알아보세요.</ReadMore>
5968

6069
3. [Wrangler 구성 파일](https://developers.cloudflare.com/workers/wrangler/configuration/)을 생성합니다.
70+
71+
`astro add cloudflare` 명령어를 실행하면 이 파일이 자동으로 생성됩니다. 어댑터를 사용하지 않는 경우 직접 생성해야 합니다.
6172

6273
<StaticSsrTabs>
6374
<Fragment slot="static">
64-
```jsonc
65-
// wrangler.jsonc
75+
```jsonc title="wrangler.jsonc"
6676
{
67-
"$schema": "node_modules/wrangler/config-schema.json",
6877
"name": "my-astro-app",
69-
// 오늘 날짜로 업데이트합니다.
70-
"compatibility_date": "2025-03-25",
78+
"compatibility_date": "YYYY-MM-DD", // 배포하는 날짜로 업데이트합니다.
7179
"assets": {
80+
"binding": "ASSETS",
7281
"directory": "./dist",
73-
"not_found_handling": "404-page" // 사용자 정의 `src/pages/404.astro` 페이지가 존재하는 경우
7482
}
7583
}
7684
```
7785
</Fragment>
7886
<Fragment slot="ssr">
79-
```jsonc
80-
// wrangler.jsonc
87+
```jsonc title="wrangler.jsonc"
8188
{
82-
"$schema": "node_modules/wrangler/config-schema.json",
89+
"main": "dist/_worker.js/index.js",
8390
"name": "my-astro-app",
84-
"main": "./dist/_worker.js/index.js",
85-
// 오늘 날짜로 업데이트합니다.
86-
"compatibility_date": "2025-03-25",
87-
"compatibility_flags": ["nodejs_compat"],
91+
"compatibility_date": "YYYY-MM-DD", // 배포하는 날짜로 업데이트합니다.
92+
"compatibility_flags": [
93+
"nodejs_compat",
94+
"global_fetch_strictly_public"
95+
],
8896
"assets": {
8997
"binding": "ASSETS",
9098
"directory": "./dist"
@@ -93,7 +101,7 @@ Astro 프로젝트에서 [Cloudflare 런타임을 사용하는 방법](/ko/guide
93101
"enabled": true
94102
}
95103
}
96-
```
104+
```
97105
</Fragment>
98106
</StaticSsrTabs>
99107

@@ -141,35 +149,123 @@ Workers Builds를 사용하는 경우:
141149
<Steps>
142150
1. [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/get-started/)를 설치합니다.
143151

144-
```bash
145-
npm install wrangler@latest --save-dev
146-
```
152+
<PackageManagerTabs>
153+
<Fragment slot="npm">
154+
```sh
155+
npm install wrangler@latest --save-dev
156+
```
157+
</Fragment>
158+
<Fragment slot="pnpm">
159+
```sh
160+
pnpm add wrangler@latest --save-dev
161+
```
162+
</Fragment>
163+
<Fragment slot="yarn">
164+
```sh
165+
yarn add wrangler@latest --dev
166+
```
167+
</Fragment>
168+
</PackageManagerTabs>
147169

148170
2. 사이트에서 요청 시 렌더링을 사용하는 경우, [`@astrojs/cloudflare` 어댑터](/ko/guides/integrations-guide/cloudflare/)를 설치합니다.
149171

150172
이 명령어는 어댑터를 설치하고 `astro.config.mjs` 파일에 필요한 변경 사항을 한 번에 적용합니다.
151173

152-
```bash
153-
npx astro add cloudflare
174+
<PackageManagerTabs>
175+
<Fragment slot="npm">
176+
```sh
177+
npx astro add cloudflare
178+
```
179+
</Fragment>
180+
<Fragment slot="pnpm">
181+
```sh
182+
pnpm astro add cloudflare
183+
```
184+
</Fragment>
185+
<Fragment slot="yarn">
186+
```sh
187+
yarn astro add cloudflare
188+
```
189+
</Fragment>
190+
</PackageManagerTabs>
191+
192+
3. [Wrangler 구성 파일](https://developers.cloudflare.com/workers/wrangler/configuration/)을 생성합니다.
193+
194+
Cloudflare는 신규 프로젝트에 Pages 대신 Workers를 사용할 것을 권장하므로, `astro add cloudflare` 명령은 Workers 프로젝트에 특화된 `wrangler.jsonc``public/.assetsignore` 파일을 생성합니다. 그래서 `public/.assetsignore` 파일을 삭제하고 `wrangler.jsonc` 파일을 수정해야 합니다. 어댑터를 사용하지 않는다면 직접 생성해야 합니다.
195+
196+
`wrangler.jsonc` 파일이 다음과 같은 구조인지 확인하세요.
197+
198+
<StaticSsrTabs>
199+
<Fragment slot="static">
200+
```jsonc title="wrangler.jsonc"
201+
{
202+
"name": "my-astro-app",
203+
"compatibility_date": "YYYY-MM-DD", // 배포하는 날짜로 업데이트합니다.
204+
"pages_build_output_dir": "./dist"
205+
}
154206
```
207+
</Fragment>
208+
<Fragment slot="ssr">
209+
```jsonc title="wrangler.jsonc"
210+
{
211+
"name": "my-astro-app",
212+
"compatibility_date": "YYYY-MM-DD", // 배포하는 날짜로 업데이트합니다.
213+
"compatibility_flags": [
214+
"nodejs_compat",
215+
"disable_nodejs_process_v2"
216+
],
217+
"pages_build_output_dir": "./dist"
218+
}
219+
```
220+
</Fragment>
221+
</StaticSsrTabs>
222+
155223
<ReadMore>[Astro의 요청 시 렌더링](/ko/guides/on-demand-rendering/)에 대해 더 자세히 알아보세요.</ReadMore>
156224

157225
3. Wrangler를 사용하여 프로젝트를 로컬에서 미리 봅니다.
158226

159-
```bash
160-
npx astro build && npx wrangler pages dev ./dist
161-
```
227+
<PackageManagerTabs>
228+
<Fragment slot="npm">
229+
```sh
230+
npx astro build && wrangler pages dev ./dist
231+
```
232+
</Fragment>
233+
<Fragment slot="pnpm">
234+
```sh
235+
pnpm astro build && wrangler pages dev ./dist
236+
```
237+
</Fragment>
238+
<Fragment slot="yarn">
239+
```sh
240+
yarn astro build && wrangler pages dev ./dist
241+
```
242+
</Fragment>
243+
</PackageManagerTabs>
162244

163245
4. `npx wrangler deploy`를 사용하여 배포합니다.
164246

165-
```bash
166-
npx astro build && npx wrangler pages deploy ./dist
167-
```
247+
<PackageManagerTabs>
248+
<Fragment slot="npm">
249+
```sh
250+
npx astro build && wrangler pages deploy ./dist
251+
```
252+
</Fragment>
253+
<Fragment slot="pnpm">
254+
```sh
255+
pnpm astro build && wrangler pages deploy ./dist
256+
```
257+
</Fragment>
258+
<Fragment slot="yarn">
259+
```sh
260+
yarn astro build && wrangler pages deploy ./dist
261+
```
262+
</Fragment>
263+
</PackageManagerTabs>
168264
</Steps>
169265

170266
자산이 업로드되면 Wrangler는 사이트를 검사할 수 있는 미리보기 URL을 제공합니다.
171267

172-
### Git을 사용하여 사이트를 배포하는 방법
268+
### CI/CD를 사용하여 사이트를 배포하는 방법
173269

174270
<Steps>
175271
1. 코드를 git 리포지토리 (예: GitHub, GitLab)에 푸시합니다.
@@ -186,6 +282,21 @@ Workers Builds를 사용하는 경우:
186282

187283
## 문제 해결
188284

285+
### 404 동작
286+
287+
Workers 프로젝트에서 사용자 정의 404 페이지를 제공하려면 `not_found_handling`을 설정해야 합니다. Cloudflare 문서의 [라우팅 동작 섹션](https://developers.cloudflare.com/workers/static-assets/#routing-behavior)에서 이에 대해 더 자세히 알아볼 수 있습니다.
288+
289+
```jsonc title="wrangler.jsonc"
290+
{
291+
"assets": {
292+
"directory": "./dist",
293+
"not_found_handling": "404-page"
294+
}
295+
}
296+
```
297+
298+
Pages 프로젝트에서 사용자 정의 404 페이지를 포함하면 해당 페이지가 기본적으로 제공됩니다. 그렇지 않으면 Pages는 [Cloudflare의 단일 페이지 애플리케이션 렌더링 동작](https://developers.cloudflare.com/pages/configuration/serving-pages/#single-page-application-spa-rendering)을 기본값으로 사용하고 404 페이지를 표시하는 대신 홈 페이지로 리디렉션합니다.
299+
189300
### 클라이언트 측 수화
190301

191302
Cloudflare의 Auto Minify 설정으로 인해 클라이언트 측 하이드레이션이 실패할 수 있습니다. 콘솔에 `Hydration completed but contains mismatches`가 표시되면 Cloudflare 설정에서 Auto Minify를 비활성화하세요.

0 commit comments

Comments
 (0)