[Turn]webpack4.0.1 installation problems and Webpack.config.js configuration changes

Source: Internet
Author: User

This article turns from: 79403637

The CLI moved into a separate package:webpack-cli. Please install ' webpack-cli ' on addition to webpack itself the CLI. When using NPM:NPM install Webpack-cli-d, when using Yarn:yarn add webpack-cli-d

webpack4.0.1 installation problem, prompt:

The CLI moved into a separate package:webpack-cli. Please install ' webpack-cli ' on addition to webpack itself the CLI. When using NPM:NPM install Webpack-cli-d

When using Yarn:yarn add webpack-cli-d

Solution:

One, the WEBPACK-V version number does not come out

Tips:

The CLI moved into a separate package:webpack-cli. Please install ' webpack-cli ' on addition to webpack itself the CLI. When using NPM:NPM install Webpack-cli-d, when using Yarn:yarn add webpack-cli-d
It means that the CLI has been moved to a special package webpack-cli. Please install WEBPACK-CLI In addition to the Webpack itself using the CLI when using NPM, use NPM install webpack-cli-d installation. When using yarn, use yarn add webpack-cli-d to install.
Workaround: Global installation webpack-cli NPM install Webpack-cli-g
will be able to prompt the publication of this number.

Second, in the project directory to install the local webpack-cli-d

NPM Install webpack-cli-d

Third, in the project directory to install the local Webpack

NPM Install webpack-d

Four, must use the configuration file: Webpack.config.js

Do not use the Webpack command, such as: Webpack demo01.js bundle01.js, can no longer execute.

V. Changes in webpack.config.js files

Webpack.config.js in the configuration, no longer support module under the loaders, need to change loaders to rules.

This is the following:

Module: {rules: [//For the CSS file, the corresponding loader processing {test:/\.css$/, loader: "Style-loader!css-loa Der "}]}

[Turn]webpack4.0.1 installation problems and Webpack.config.js configuration changes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.