Skip to content

updated 4.md #2834

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

Merged
merged 16 commits into from
Aug 1, 2019
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/content/migrate/4.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
---
title: To v4 from v3
group: Migrate
sort: 1
contributors:
- sokra
- EugeneHlushko
- Kolhar730
related:
- title: 'To v2 or v3 from v1'
url: https://webpack.js.org/migrate/3/
- title: 'RIP CommonChunkPlugin'
url: https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693
- title: 'webpack 4: migration guide for plugins/loaders'
url: https://medium.com/webpack/webpack-4-migration-guide-for-plugins-loaders-20a79b927202
---

This guide only shows major changes that affect end users. For more details please see [the changelog](https://github.com/webpack/webpack/releases).
Expand All @@ -12,22 +21,26 @@ This guide only shows major changes that affect end users. For more details plea
## Node.js v4

If you are still using Node.js v4 or lower, you need to upgrade your Node.js installation to Node.js v6 or higher.


Instructions for upgrading your Node.js version can be found [here](https://stackoverflow.com/questions/10075990/upgrading-node-js-to-latest-version).

## CLI

The CLI has moved to a separate package: webpack-cli. You need to install it before using webpack, see [basic setup](/guides/getting-started/#basic-setup).

The installation guide can be found [here](/guides/installation).


## Update plugins

Many 3rd-party plugins need to be upgraded to their latest version to be compatible.
Many 3rd party plugins need to be updated to the latest versions to be compatible with webpack 4. Links to popular plugins can be found [here](https://github.com/webpack-contrib/awesome-webpack#webpack-plugins).


## mode

Add the new [`mode`](/configuration/mode/) option to your config. Set it to production or development in your configuration depending on config type.


__webpack.config.js__

``` diff
Expand All @@ -37,7 +50,7 @@ module.exports = {
}
```

Alternatively you can pass it via CLI: `--mode production`/`--mode development`
T> The purpose of `development` mode and `production` mode is different. You can use `webpack-merge` as shown in [production guide](/guides/production/#setup) to optimize configurations.

## Deprecated/Removed plugins

Expand Down Expand Up @@ -156,3 +169,4 @@ module.exports = {
## module.loaders

`module.loaders` were deprecated since webpack 2 and are now removed in favor of [`module.rules`](/configuration/module/#rule).