Skip to content

Commit f128d83

Browse files
committed
Initial changes
1 parent 136bcdc commit f128d83

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/content/concepts/index.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
---
2-
title: Core Concepts
2+
title: Concepts
33
sort: 1
44
contributors:
55
- TheLarkInn
66
- jhnns
77
- grgur
88
- johnstew
99
- jimrfenner
10+
- TheDutchCoder
1011
---
1112

12-
*webpack* is a _module bundler_ for modern JavaScript applications. When webpack processes your application, it recursively builds a _dependency graph_ that includes every module your application needs, then packages all of those modules into a small number of _bundles_ - often only one - to be loaded by the browser.
13+
At its core, *webpack* is a _module bundler_ for modern JavaScript applications. When webpack processes your application, it recursively builds a _dependency graph_ that includes every module your application needs, then packages all of those modules into one or more _bundles_ to be loaded by the browser.
1314

14-
It is [incredibly configurable](/configuration), but to get started you only need to understand **Four Core Concepts**: entry, output, loaders, and plugins.
15+
It is [incredibly configurable](/configuration), but to get started you only need to understand four **Core Concepts**:
16+
* Entry
17+
* Output
18+
* Loaders
19+
* Plugins
1520

1621
This document is intended to give a **high-level** overview of these concepts, while providing links to detailed concept specific use cases.
1722

1823

1924
## Entry
2025

21-
webpack creates a graph of all of your application's dependencies. The starting point of this graph is known as an _entry point_. The _entry point_ tells webpack _where to start_ and follows the graph of dependencies to know _what to bundle_. You can think of your application's _entry point_ as the **contextual root** or **the first file to kick off your app**.
26+
The **entry** is the starting point for webpack to generate its internal *dependency graph*. This means that webpack starts at your entry point and figures out all the other files and libraries that your entry point is dependent on. It then generates files called *bundles* bases on the **output** configuration (which we'll tackle in the next session).
2227

23-
In webpack we define _entry points_ using the `entry` property in our [webpack configuration object](/configuration).
28+
You can tell webpack which entry point(s) to use by configuring the `entry` property in the [webpack configuration](/configuration).
2429

25-
The simplest example is seen below:
30+
Here's the simplest example of the `entry` configuration:
2631

27-
**webpack.config.js**
32+
__webpack.config.js__
2833

29-
```javascript
34+
``` js
3035
module.exports = {
3136
entry: './path/to/my/entry/file.js'
3237
};
3338
```
3439

35-
There are multiple ways to declare your `entry` property that are specific to your application's needs.
36-
37-
[Learn more!](/concepts/entry-points)
40+
T> There are multiple ways to declare your `entry` property that are specific to your application's needs. You can learn more about this in the [entry points concepts](/concepts/entry-points).
3841

3942

4043
## Output
4144

42-
Once you've bundled all of your assets together, you still need to tell webpack **where** to bundle your application. The webpack `output` property tells webpack **how to treat bundled code**.
45+
The **output** tells webpack where to output the *bundles* it creates. It can also be used to generate filenames dynamically. You can configure the output by specifying an `output` property in the webpack configuration file:
4346

44-
**webpack.config.js**
47+
__webpack.config.js__
4548

4649
```javascript
4750
const path = require('path');
@@ -59,20 +62,18 @@ In the example above, we use the `output.filename` and the `output.path` propert
5962

6063
T> You may see the term **emitted** or **emit** used throughout our documentation and [plugin API](/api/plugins). This is a fancy term for 'produced' or 'discharged'.
6164

62-
The `output` property has [many more configurable features](/configuration/output), but let's spend some time understanding some of the most common use cases for the `output` property.
63-
64-
[Learn more!](/concepts/output)
65+
The `output` property has [many more configurable features](/configuration/output) and if you like to know more about the concepts behind the `output` property, you can [read more in the concepts section](/concepts/output).
6566

6667

6768
## Loaders
6869

69-
The goal is to have all of the assets in your project be **webpack's** concern and not the browser's (though, to be clear, this doesn't mean that they all have to be bundled together). webpack treats [every file (.css, .html, .scss, .jpg, etc.) as a module](/concepts/modules). However, webpack itself **only understands JavaScript**.
70+
*Loaders* enable webpack to process more than just JavaScript files (webpack itself only understands JavaScript). They make sure that you can leverage webpack's bundling abilities for files that aren't JavaScript by treating them as [webpack modules](/concepts/modules).
7071

71-
**Loaders in webpack _transform these files into modules_ as they are added to your dependency graph.**
72+
In short: **Loaders in webpack _transform non JavaScript files into modules_ as they are added to your dependency graph.**
7273

7374
At a high level, **loaders** have two purposes in your webpack config. They work to:
7475

75-
1. Identify which file or files should be transformed by a certain Loader. (`test` property)
76+
1. Identify which file or files should be transformed by a certain loader (with the `test` property).
7677
2. Transform those files so that they can be added to your dependency graph (and eventually your bundle). (`use` property)
7778

7879
**webpack.config.js**

0 commit comments

Comments
 (0)