Vue Cli 5

Posted on  by admin
First, install the latest Vue CLI globally:.

In your existing projects, run:. And then follow the command line instructions. Note that the migrator is not complete yet and doesn't cover all cases. Please read the following section for detailed breaking changes introduced in each package. If you see errors like setup compilation vue-loader-plugin(node:44156) UnhandledPromiseRejectionWarning: TypeError: The 'compilation' argument must be an instance of Compilation after upgrading, please remove the lockfile (yarn.lock or package-lock.json) and node_modules in the project and reinstall all the dependencies.

If you want to migrate manually and gradually, you can run vue upgrade to upgrade a specific Vue CLI plugin. Drop support of Node.js 8-11 and 13. Drop support of NPM 5. The instant prototyping functionalities are removed.

Now the vue serve / vue build commands are aliases to npm run serve / npm run build, which in turn execute the scripts specified in the project package.json. If you need a minimum setup for developing standalone .vue components, please use or instead.

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).

Besides the internal changes that are only noticeable for custom configurations, there're several notable changes for user-land code too:.

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);. 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. webpack-dev-server has been updated from v3 to v4. So there are breaking changes with regard to the devServer option in vue.config.js. Please check out the webpack-dev-server migration guide for more details. The disableHostCheck option was removed in favor allowedHosts: 'all';. public, sockHost, sockPath, and sockPort options were removed in favor client.webSocketURL option.

IE9 support of the dev server is not enabled by default. If you need to develop under IE9, please manually set the devServer.webSocketServer option to sockjs.


Not the answer you're looking for? Browse other questions tagged javascriptwebpackvuejs2 or ask your own question.