You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/concepts/targets.md
+2-17Lines changed: 2 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,27 +16,12 @@ To set the `target` property, you simply set the target value in your webpack co
16
16
**webpack.config.js**
17
17
18
18
```javascript
19
-
constconfig= {
19
+
module.exports= {
20
20
target:'node'
21
21
};
22
-
23
-
module.exports= config;
24
22
```
25
23
26
-
## Options
27
-
28
-
The following is a list of values you can pass to the `target` property.
29
-
30
-
*`"async-node"` Compile for usage in a Node.js-like environment (use `fs` and `vm` to load chunks async)
31
-
*`"electron-main"` Compile for electron renderer process, provide a target using `JsonpTemplatePlugin`, `FunctionModulePlugin` for browser environment and `NodeTargetPlugin` and `ExternalsPlugin` for commonjs and electron bulit-in modules. *Note: need `webpack` >= 1.12.15.
32
-
*`"node"` Compile for usage in a Node.js-like environment (uses Node.js `require` to load chunks)
33
-
*`"node-webkit"` Compile for usage in webkit, uses jsonp chunk loading but also supports build in Node.js modules plus require("nw.gui") (experimental)
34
-
*`"web"` Compile for usage in a browser-like environment (default)
35
-
*`"webworker"` Compile as WebWorker
36
-
37
-
Each _target_ has a variety of deployment/environment specific additions, support to fit its needs.
38
-
39
-
For example, when you use the `electron-main`_target_, *webpack* includes multiple `electron-main` specific variables. For more information on which templates and _externals_ are used, you can refer [directly to the webpack source code](https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsApply.js#L70-L185).
24
+
Each _target_ has a variety of deployment/environment specific additions, support to fit its needs. See what [targets are available](/configuration/target).
40
25
41
26
?> We should expand on this further. What specifically is included.
Copy file name to clipboardExpand all lines: content/configuration/target.md
+12-22Lines changed: 12 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,38 +5,28 @@ contributors:
5
5
- juangl
6
6
- sokra
7
7
- skipjack
8
+
- SpaceK33z
8
9
---
9
10
10
-
?> Compare with [the concept page](/concepts/targets)and determine what goes where.
11
+
webpack can compile to multiple environments. We call this _targets_. This page shows what targets are supported. [The concept page](/concepts/targets)explains in greater detail what a target is.
11
12
12
13
## `target`
13
14
14
15
`string`
15
16
16
-
Tell webpack what environment the application is targeting. The following options are supported:
17
+
Tell webpack what environment the application is targeting. The following values are supported:
17
18
18
-
`target: "node"` - Compile for [NodeJS](https://nodejs.org/en/), using `require` to load chunks
19
+
*`"async-node"` Compile for usage in a Node.js-like environment (use `fs` and `vm` to load chunks async)
20
+
*`"electron"` Compile for [Electron](http://electron.atom.io/) renderer process, provide a target using `JsonpTemplatePlugin`, `FunctionModulePlugin` for browser environment and `NodeTargetPlugin` and `ExternalsPlugin` for CommonJs and Electron built-in modules.
21
+
*`"electron-renderer"` - Compile for [Electron](http://electron.atom.io/) for `renderer-process`
22
+
*`"node"` Compile for usage in a Node.js-like environment (uses Node.js `require` to load chunks)
23
+
*`"node-webkit"` Compile for usage in WebKit and uses jsonp chunk loading. Allows importing of built-in Node.js modules and [`nw.gui`](http://docs.nwjs.io/en/latest/) (experimental)
24
+
*`"web"` Compile for usage in a browser-like environment (default)
25
+
*`"webworker"` Compile as WebWorker
19
26
20
-
`target: "node-webkit"`- Compile for [Webkit](https://webkit.org/), using [JSONP](https://sacha.me/articles/jsonp-demystified/) to load chunks
27
+
For example, when you use the `"electron"`_target_, *webpack* includes multiple Electron specific variables. For more information on which templates and _externals_ are used, you can refer [directly to the webpack source code](https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsApply.js#L70-L185).
21
28
22
-
`target: "web"` - Compile for usage in a browser
23
-
24
-
`target: "webworker"` - Compile as a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)
25
-
26
-
27
-
T> Allows importing of built-in Node.js modules and [`nw.gui`](http://docs.nwjs.io/en/latest/) (experimental).
28
-
29
-
`target: "async-node"` - Use `fs` and `vm` to load chunks asynchronously
30
-
31
-
`target: "electron"` - Compile for [Electron](http://electron.atom.io/) for `main-process`
32
-
33
-
`target: "electron-main"` - Alias for `target: "electron"`
34
-
35
-
`target: "electron-renderer"` - Compile for [Electron](http://electron.atom.io/) for `renderer-process`
0 commit comments