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: docs/migrations/migrate-from-v4.md
+48-11
Original file line number
Diff line number
Diff line change
@@ -43,35 +43,72 @@ If you want to migrate manually and gradually, you can run `vue upgrade <the-plu
43
43
44
44
### `@vue/cli-service`
45
45
46
-
Updated several underlying loaders and plugins:
46
+
#### Webpack 5
47
47
48
-
* Updated `copy-webpack-plugin` from v5 to v6. If you never customized its config through `config.plugin('copy')`, there should be no user-facing breaking changes. A full list of breaking changes is available at <https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v6.0.0>.
49
-
* Updated `file-loader` from v4 to v6, and `url-loader` from v2 to v4. The `esModule` option is now turned on by default for non-Vue-2 projects. Full changelog available at <https://github.com/webpack-contrib/file-loader/blob/master/CHANGELOG.md> and <https://github.com/webpack-contrib/url-loader/blob/master/CHANGELOG.md>
50
-
* Updated `terser-webpack-plugin` from v2 to v4, using terser 5 and some there are some changes in the options format. Full changelog at <https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md>
48
+
We've upgraded the underlying webpack version to 5. There are plenty of breaking changes underlyingly, listed in the release announcement page [Webpack 5 release (2020-10-10)](https://webpack.js.org/blog/2020-10-10-webpack-5-release/).
49
+
50
+
Besides the internal changes that are only noticeable for custom configurations, there're several notable changes for user-land code too:
51
+
52
+
1. Named exports from JSON modules are no longer supported. Instead of `import { version } from './package.json'; console.log(version);` use `import package from './package.json'; console.log(package.version);`
53
+
2. Webpack 5 does no longer include polyfills for Node.js modules by default. You shall see an informative error message if your code relies on any of these modules. A detailed list of previously polyfilled modules is also available [here](https://github.com/webpack/webpack/pull/8460/commits/a68426e9255edcce7822480b78416837617ab065).
54
+
55
+
#### Opt Out to Webpack 4
56
+
57
+
Considering many ecosystem packages haven't catched up yet, we provided a way to opt out to webpack 4 for easier migration.
58
+
59
+
If you are using Yarn or PNPM 5.10+, you can specify the `"resolutions"` field in your `package.json`:
60
+
61
+
```json
62
+
{
63
+
"resolutions": {
64
+
"@vue/cli-*/webpack": "^4.44.2"
65
+
}
66
+
}
67
+
```
68
+
69
+
and then rerun `yarn` or `pnpm install` to force Vue CLI to use webpack 4.
70
+
71
+
If you are using NPM, you can simply add webpack 4 to the project's `devDependencies`: `npm i -D webpack@4`. Vue CLI will redirect all the underlying requests to webpack to this version through [`module-alias`](https://github.com/ilearnio/module-alias).
72
+
73
+
Though it works in all our tests, please be aware that this approach is still somehow hacky and may not be as stable as the `"resolutions"` approach.
74
+
75
+
#### Underlying Loaders and Plugins
76
+
77
+
*`html-webpack-plugin` is upgraded from v3 to v4, see more details in the [release announcement](https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d).
78
+
*`copy-webpack-plugin` is upgraded from v5 to v6. If you never customized its config through `config.plugin('copy')`, there should be no user-facing breaking changes. A full list of breaking changes is available at [`copy-webpack-plugin` v6.0.0 release](https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v6.0.0).
79
+
*`file-loader` is upgraded from v4 to v6, and `url-loader` from v2 to v4. The `esModule` option is now turned on by default for non-Vue-2 projects. Full changelog available at [`file-loader` changelog](https://github.com/webpack-contrib/file-loader/blob/master/CHANGELOG.md) and [`url-loader` changelog](https://github.com/webpack-contrib/url-loader/blob/master/CHANGELOG.md)
80
+
*`terser-webpack-plugin` is upgraded from v2 to v4, using terser 5 and some there are some changes in the options format. See full details in its [changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md#400-2020-08-04).
51
81
52
82
### ESLint Plugin
53
83
54
84
*`eslint-loader` is upgraded [from v2 to v4](https://github.com/webpack-contrib/eslint-loader/blob/master/CHANGELOG.md). The only major change is that it dropped support for ESLint < v6.
55
85
86
+
### PWA Plugin
87
+
88
+
* The underlying `workbox-webpack-plugin` is upgraded from v4 to v6. Detailed migration guides available on workbox's website:
89
+
*[From Workbox v4 to v5](https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-v4)
90
+
*[From Workbox v5 to v6](https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-v5)
91
+
56
92
### TypeScript Plugin
57
93
58
94
* Dropped TSLint support. As [TSLint has been deprecated](https://github.com/palantir/tslint/issues/4534), we [removed](https://github.com/vuejs/vue-cli/pull/5065) all TSLint-related code in this version.
59
95
Please consider switching to ESLint. You can check out [`tslint-to-eslint-config`](https://github.com/typescript-eslint/tslint-to-eslint-config) for a mostly automatic migration experience.
60
-
*Updated `ts-loader` from v6 to v8. It now only supports TypeScript >= 3.6.
61
-
*Updated `fork-ts-checker-webpack-plugin` from v3.x to v5.x, you can see the detailed breaking changes at <https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases/tag/v4.0.0> and <https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases/tag/v5.0.0>
96
+
*`ts-loader` is upgraded from v6 to v8. It now only supports TypeScript >= 3.6.
97
+
*`fork-ts-checker-webpack-plugin`is upgraded from v3.x to v5.x, you can see the detailed breaking changes at [`fork-ts-checker=webpack-plugin` v4.0.0 release](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases/tag/v4.0.0) and [`fork-ts-checker=webpack-plugin` v5.0.0 release](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases/tag/v5.0.0)
62
98
63
99
### E2E-Cypress Plugin
64
100
65
-
* Cypress is updated from v3 to v5. See <https://docs.cypress.io/guides/references/migration-guide.html> for a detailed migration guide.
101
+
* Cypress is required as a peer dependency.
102
+
* Cypress is updated from v3 to v5. See [Cypress Migration Guide](https://docs.cypress.io/guides/references/migration-guide.html) for detailed instructions of the migration process.
66
103
67
104
### Unit-Mocha Plugin
68
105
69
-
*Updated `mocha` from v6 to v7, please refer to the release notes of [mocha v7](https://github.com/mochajs/mocha/releases/tag/v7.0.0) for a complete list of breaking changes.
70
-
*Updated `jsdom` from v15 to v16, the breaking changes are listed at <https://github.com/jsdom/jsdom/releases/tag/16.0.0>
106
+
*`mocha`is upgraded from v6 to v7, please refer to the [release notes of mocha v7](https://github.com/mochajs/mocha/releases/tag/v7.0.0) for a complete list of breaking changes.
107
+
*`jsdom`is upgraded from v15 to v16, the breaking changes are listed at [`jsdom` v16.0.0 release](https://github.com/jsdom/jsdom/releases/tag/16.0.0)
71
108
72
109
### Internal Packages
73
110
74
111
#### `@vue/cli-shared-utils`
75
112
76
-
*Bump [chalk](https://github.com/chalk/chalk) from v2 to v4
77
-
*Bump [joi](https://github.com/sideway/joi) from v15 (used to be `@hapi/joi`) to v17
113
+
*[chalk](https://github.com/chalk/chalk) is upgraded from v2 to v4
114
+
*[joi](https://github.com/sideway/joi) is upgraded from v15 (used to be `@hapi/joi`) to v17
0 commit comments