Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(config) target updates to current webpack state #2597

Merged
merged 1 commit into from Oct 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/content/configuration/target.md
Expand Up @@ -9,13 +9,14 @@ contributors:
- pastelsky
- tbroadley
- byzyk
- EugeneHlushko
---

webpack can compile for multiple environments or _targets_. To understand what a `target` is in detail, read through [the targets concept page](/concepts/targets).
webpack can compile for multiple environments or _targets_. To understand what a `target` is in detail, read through [the targets concept page](/concepts/targets/).

## `target`

`string | function(compiler)`
`string | function (compiler)`

Instructs webpack to target a specific environment.

Expand All @@ -27,16 +28,14 @@ The following string values are supported via [`WebpackOptionsApply`](https://gi
Option | Description
--------------------- | -----------------------
`async-node` | Compile for usage in a Node.js-like environment (uses `fs` and `vm` to load chunks asynchronously)
~~`atom`~~ | Alias for `electron-main`
~~`electron`~~ | Alias for `electron-main`
`electron-main` | Compile for [Electron](https://electronjs.org/) for main process.
`electron-renderer` | Compile for [Electron](https://electronjs.org/) for renderer process, providing a target using `JsonpTemplatePlugin`, `FunctionModulePlugin` for browser environments and `NodeTargetPlugin` and `ExternalsPlugin` for CommonJS and Electron built-in modules.
`node` | Compile for usage in a Node.js-like environment (uses Node.js `require` to load chunks)
`node-webkit` | Compile for usage in WebKit and uses JSONP for chunk loading. Allows importing of built-in Node.js modules and [`nw.gui`](http://docs.nwjs.io/en/latest/) (experimental)
`web` | Compile for usage in a browser-like environment **(default)**
`webworker` | Compile as WebWorker

For example, when the `target` is set to `"electron"`, webpack includes multiple electron specific variables. For more information on which templates and externals are used, you can refer to webpack's [source code](https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsApply.js#L70-L185).
For example, when the `target` is set to `"electron-main"`, webpack includes multiple electron specific variables. For more information on which templates and externals are used, you can refer to webpack's [source code](https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsApply.js#L148-L183).


### `function`
Expand Down