Skip to content

Commit 68563bd

Browse files
liante0904simsim0709
authored andcommitted
Translate code-splitting.md (#55)
* Translate code-splitting.md to Kor. * Apply review feedback * Apply feedback, Fix unnatural translation. * Apply feedback. * Apply hide feedback. * Fix router translation. * Apply spacing words feedback. * Change words, polish. * Apply feedback on the translation of the routes and route-based. * Update code-splitting.md
1 parent 1a83151 commit 68563bd

File tree

1 file changed

+51
-73
lines changed

1 file changed

+51
-73
lines changed

content/docs/code-splitting.md

+51-73
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
---
22
id: code-splitting
3-
title: Code-Splitting
3+
title: 코드 분할
44
permalink: docs/code-splitting.html
55
---
66

7-
## Bundling {#bundling}
7+
## 번들링 {#bundling}
88

9-
Most React apps will have their files "bundled" using tools like
10-
[Webpack](https://webpack.js.org/) or [Browserify](http://browserify.org/).
11-
Bundling is the process of following imported files and merging them into a
12-
single file: a "bundle". This bundle can then be included on a webpage to load
13-
an entire app at once.
9+
대부분 React 앱들은 [Webpack](https://webpack.js.org/) 이나 [Browserify](http://browserify.org/) 같은 툴을 사용하여 여러 파일을 하나로 병합한 "번들 된" 파일을 웹 페이지에 포함하여 한 번에 전체 앱을 로드 할 수 있습니다.
1410

15-
#### Example {#example}
11+
#### 예시 {#example}
1612

17-
**App:**
13+
**App**
1814

1915
```js
2016
// app.js
@@ -30,7 +26,7 @@ export function add(a, b) {
3026
}
3127
```
3228

33-
**Bundle:**
29+
**Bundle**
3430

3531
```js
3632
function add(a, b) {
@@ -40,86 +36,71 @@ function add(a, b) {
4036
console.log(add(16, 26)); // 42
4137
```
4238

43-
> Note:
39+
> 주의
4440
>
45-
> Your bundles will end up looking a lot different than this.
41+
> 실제 번들은 위 예시와는 많이 다르게 보일 겁니다.
4642
47-
If you're using [Create React App](https://github.com/facebookincubator/create-react-app), [Next.js](https://github.com/zeit/next.js/), [Gatsby](https://www.gatsbyjs.org/), or a similar tool, you will have a Webpack setup out of the box to bundle your
48-
app.
43+
[Create React App](https://github.com/facebookincubator/create-react-app)이나 [Next.js](https://github.com/zeit/next.js/), [Gatsby](https://www.gatsbyjs.org/) 혹은 비슷한 툴을 사용한다면 여러분이 설치한 앱에서 Webpack을 같이 설치했을 겁니다.
4944

50-
If you aren't, you'll need to setup bundling yourself. For example, see the
51-
[Installation](https://webpack.js.org/guides/installation/) and
52-
[Getting Started](https://webpack.js.org/guides/getting-started/) guides on the
53-
Webpack docs.
45+
이런 툴을 사용하지 않는다면 여러분이 스스로 번들링을 설정해야 합니다. 이 경우 Webpack의
46+
[설치하기](https://webpack.js.org/guides/installation/) 문서와
47+
[시작하기](https://webpack.js.org/guides/getting-started/) 문서를 참조해 주세요.
5448

55-
## Code Splitting {#code-splitting}
49+
## 코드 분할 {#code-splitting}
5650

57-
Bundling is great, but as your app grows, your bundle will grow too. Especially
58-
if you are including large third-party libraries. You need to keep an eye on
59-
the code you are including in your bundle so that you don't accidentally make
60-
it so large that your app takes a long time to load.
51+
번들링은 훌륭하지만 여러분의 앱이 커지면 번들도 커집니다. 특히 큰 규모의 서드 파티 라이브러리를 추가할 때 실수로 앱이 커져서 로드 시간이 길어지는 것을 방지하기 위해 코드를 주의 깊게 살펴야 합니다.
6152

62-
To avoid winding up with a large bundle, it's good to get ahead of the problem
63-
and start "splitting" your bundle.
64-
[Code-Splitting](https://webpack.js.org/guides/code-splitting/) is a feature
65-
supported by bundlers like Webpack and Browserify (via
66-
[factor-bundle](https://github.com/browserify/factor-bundle)) which can create
67-
multiple bundles that can be dynamically loaded at runtime.
53+
번들이 거대해지는 것을 방지하기 위한 좋은 해결방법은 번들을 "나누는" 것입니다.
54+
[코드 분할](https://webpack.js.org/guides/code-splitting/)은 런타임시 여러 번들을 동적으로 만들고 불러오는 것으로 Webpack 와 Browserify ([factor-bundle](https://github.com/browserify/factor-bundle)) 같은 번들러들이 지원하는 기능입니다.
6855

69-
Code-splitting your app can help you "lazy-load" just the things that are
70-
currently needed by the user, which can dramatically improve the performance of
71-
your app. While you haven't reduced the overall amount of code in your app,
72-
you've avoided loading code that the user may never need, and reduced the amount
73-
of code needed during the initial load.
56+
57+
코드 분할은 여러분의 앱을 "지연 로딩" 하게 도와주고 앱 사용자에게 획기적인 성능 향상을 하게 합니다.
58+
앱의 코드 양을 줄이지 않고도 사용자가 필요하지 않은 코드를 불러오지 않게 하며 앱의 초기화 로딩에 필요한 비용을 줄여줍니다.
7459

7560
## `import()` {#import}
7661

77-
The best way to introduce code-splitting into your app is through the dynamic
78-
`import()` syntax.
62+
앱에 코드 분할을 도입하는 가장 좋은 방법은 동적 `import()` 문법을 사용하는 방법입니다.
7963

80-
**Before:**
64+
**Before**
8165

8266
```js
8367
import { add } from './math';
8468

8569
console.log(add(16, 26));
8670
```
8771

88-
**After:**
72+
**After**
8973

9074
```js
9175
import("./math").then(math => {
9276
console.log(math.add(16, 26));
9377
});
9478
```
9579

96-
> Note:
80+
> 주의
9781
>
98-
> The dynamic `import()` syntax is a ECMAScript (JavaScript)
99-
> [proposal](https://github.com/tc39/proposal-dynamic-import) not currently
100-
> part of the language standard. It is expected to be accepted in the
101-
> near future.
82+
> 동적 `import()` 문법은 아직 ECMAScript (JavaScript)의 표준 문법이 아니라
83+
> [제안](https://github.com/tc39/proposal-dynamic-import)입니다.
84+
> 동적 `import()`은 가까운 미래에 표준에 추가될 것으로 보입니다.
10285
103-
When Webpack comes across this syntax, it automatically starts code-splitting
104-
your app. If you're using Create React App, this is already configured for you
105-
and you can [start using it](https://facebook.github.io/create-react-app/docs/code-splitting) immediately. It's also supported
106-
out of the box in [Next.js](https://github.com/zeit/next.js/#dynamic-import).
86+
Webpack이 이 구문을 만나게 되면 앱의 코드를 분할합니다.
87+
Create React App을 사용하고 있다면 이미 Webpack이 구성이 되어 있기 때문에 즉시 [사용](https://facebook.github.io/create-react-app/docs/code-splitting)할 수 있습니다.
88+
[Next.js](https://github.com/zeit/next.js/#dynamic-import) 역시 지원합니다.
10789

108-
If you're setting up Webpack yourself, you'll probably want to read Webpack's
109-
[guide on code splitting](https://webpack.js.org/guides/code-splitting/). Your Webpack config should look vaguely [like this](https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269).
90+
스스로 Webpack을 구성하고자 한다면 Webpack의
91+
[코드 분할 가이드](https://webpack.js.org/guides/code-splitting/)를 참조하세요. Webpack 설정은 [가이드](https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269)에 있습니다.
11092

111-
When using [Babel](https://babeljs.io/), you'll need to make sure that Babel can
112-
parse the dynamic import syntax but is not transforming it. For that you will need [babel-plugin-syntax-dynamic-import](https://yarnpkg.com/en/package/babel-plugin-syntax-dynamic-import).
93+
[Babel](http://babeljs.io/)을 사용할 때는 Babel이 동적 import를 인식할 수 있지만 변환하지는 않도록 합니다. 이를 위해 [babel-plugin-syntax-dynamic-import](https://yarnpkg.com/en/package/babel-plugin-syntax-dynamic-import)를 사용하세요.
11394

11495
## `React.lazy` {#reactlazy}
11596

116-
> Note:
97+
> 주의
11798
>
118-
> `React.lazy` and Suspense is not yet available for server-side rendering. If you want to do code-splitting in a server rendered app, we recommend [Loadable Components](https://github.com/smooth-code/loadable-components). It has a nice [guide for bundle splitting with server-side rendering](https://github.com/smooth-code/loadable-components/blob/master/packages/server/README.md).
99+
> `React.lazy`와 Suspense는 아직 서버 사이드 렌더링을 할 수 없습니다. 서버에서 렌더링 된 앱에서 코드 분할을 하기 원한다면 [Loadable Components](https://github.com/smooth-code/loadable-components)를 추천합니다. 이는 [서버 사이드 렌더링과 번들 스플리팅에 대한 좋은 가이드](https://github.com/smooth-code/loadable-components/blob/master/packages/server/README.md)입니다.
119100
120-
The `React.lazy` function lets you render a dynamic import as a regular component.
101+
`React.lazy` 함수를 사용하면 동적 import를 사용해서 컴포넌트를 렌더링 할 수 있습니다.
121102

122-
**Before:**
103+
**Before**
123104

124105
```js
125106
import OtherComponent from './OtherComponent';
@@ -133,7 +114,7 @@ function MyComponent() {
133114
}
134115
```
135116

136-
**After:**
117+
**After**
137118

138119
```js
139120
const OtherComponent = React.lazy(() => import('./OtherComponent'));
@@ -146,14 +127,14 @@ function MyComponent() {
146127
);
147128
}
148129
```
130+
`MyComponent`가 렌더링 될 때 `OtherComponent`를 포함한 번들을 자동으로 불러옵니다.
149131

150-
This will automatically load the bundle containing the `OtherComponent` when this component gets rendered.
151-
152-
`React.lazy` takes a function that must call a dynamic `import()`. This must return a `Promise` which resolves to a module with a `default` export containing a React component.
132+
`React.lazy`는 동적 `import()`를 호출하는 함수를 인자로 가집니다. 이 함수는 React 컴포넌트를
133+
포함하며 `default` export를 가진 모듈로 결정되는 `Promise`로 반환해야 합니다.
153134

154135
### Suspense {#suspense}
155136

156-
If the module containing the `OtherComponent` is not yet loaded by the time `MyComponent` renders, we must show some fallback content while we're waiting for it to load - such as a loading indicator. This is done using the `Suspense` component.
137+
`MyComponent`를 렌더링할 때 `OtherComponent`를 포함하는 모듈이 아직 로드되지 않았다면, 로드를 기다리는 동안 로딩처럼 예비 컨텐츠를 보여줘야 합니다. 이는 `Suspense` 컴포넌트를 사용하여 처리할 수 있습니다.
157138

158139
```js
159140
const OtherComponent = React.lazy(() => import('./OtherComponent'));
@@ -169,7 +150,8 @@ function MyComponent() {
169150
}
170151
```
171152

172-
The `fallback` prop accepts any React elements that you want to render while waiting for the component to load. You can place the `Suspense` component anywhere above the lazy component. You can even wrap multiple lazy components with a single `Suspense` component.
153+
`fallback` prop은 컴포넌트가 로드될 때까지 기다리는 동안 렌더링하려는 React 엘리먼트를 받아들입니다. `Suspense` 컴포넌트는 lazy 컴포넌트를 감쌉니다. 하나의 `Suspense` 컴포넌트로 여러 lazy 컴포넌트를 감쌀 수도 있습니다.
154+
173155

174156
```js
175157
const OtherComponent = React.lazy(() => import('./OtherComponent'));
@@ -190,8 +172,8 @@ function MyComponent() {
190172
```
191173

192174
### Error boundaries {#error-boundaries}
193-
194-
If the other module fails to load (for example, due to network failure), it will trigger an error. You can handle these errors to show a nice user experience and manage recovery with [Error Boundaries](/docs/error-boundaries.html). Once you've created your Error Boundary, you can use it anywhere above your lazy components to display an error state when there's a network error.
175+
네트워크 장애 같은 이유로 다른 모듈을 로드에 실패할 경우 에러를 발생시킬 수 있습니다. 이때 [Error Boundaries](/docs/error-boundaries.html)를 이용하여 사용자의 경험과 복구 관리를 처리할 수 있습니다.
176+
Error Boundary를 만들고 lazy 컴포넌트를 감싸면 네트워크 장애가 발생했을 때 에러를 표시할 수 있습니다.
195177

196178
```js
197179
import MyErrorBoundary from './MyErrorBoundary';
@@ -214,17 +196,13 @@ const MyComponent = () => (
214196

215197
## Route-based code splitting {#route-based-code-splitting}
216198

217-
Deciding where in your app to introduce code splitting can be a bit tricky. You
218-
want to make sure you choose places that will split bundles evenly, but won't
219-
disrupt the user experience.
199+
앱에 코드 분할을 어느 곳에 도입할지 결정하는 것은 조금 까다롭습니다.
200+
여러분은 사용자의 경험을 헤치지 않으면서 번들을 균등하게 분배할 곳을 찾고자 합니다.
220201

221-
A good place to start is with routes. Most people on the web are used to
222-
page transitions taking some amount of time to load. You also tend to be
223-
re-rendering the entire page at once so your users are unlikely to be
224-
interacting with other elements on the page at the same time.
202+
이를 시작하기 좋은 장소는 라우트입니다. 웹 페이지를 불러오는 시간은 페이지 전환에 어느 정도 발생하며 대부분 페이지를 한번에 렌더링하기 때문에
203+
사용자가 페이지를 렌더링하는 동안 다른 요소와 상호작용하지 않습니다.
225204

226-
Here's an example of how to setup route-based code splitting into your app using
227-
libraries like [React Router](https://reacttraining.com/react-router/) with `React.lazy`.
205+
`React.lazy`[React Router](https://reacttraining.com/react-router/) 라이브러리를 사용해서 애플리케이션에 라우트 기반 코드 분할을 설정하는 예시입니다.
228206

229207
```js
230208
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
@@ -247,7 +225,7 @@ const App = () => (
247225

248226
## Named Exports {#named-exports}
249227

250-
`React.lazy` currently only supports default exports. If the module you want to import uses named exports, you can create an intermediate module that reexports it as the default. This ensures that treeshaking keeps working and that you don't pull in unused components.
228+
`React.lazy`는 현재 default exports만 지원합니다. named exports를 사용하고자 한다면 default로 이름을 재정의한 중간 모듈을 생성할 수 있습니다. 이렇게 하면 treeshaking이 계속 동작하고 사용하지 않는 컴포넌트는 가져오지 않습니다.
251229

252230
```js
253231
// ManyComponents.js

0 commit comments

Comments
 (0)