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 5 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
18 changes: 15 additions & 3 deletions src/content/migrate/4.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sort: 1
contributors:
- sokra
- EugeneHlushko
- Kolhar730
---

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 +13,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`](/concepts/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 +42,7 @@ module.exports = {
}
```

Alternatively you can pass it via CLI: `--mode production`/`--mode development`
T> Since the goals of the `development` and `production` versions are different. You could use `webpack-merge` to use the best of both modes. Read more [here](/guides/production)

## Deprecated/Removed plugins

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

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


## Additional Reading

- [RIP CommonChunkPlugin](https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693)

- [webpack 4: migration guide for plugins/loaders](https://medium.com/webpack/webpack-4-migration-guide-for-plugins-loaders-20a79b927202)