webpack build a project

Hot replacement

Because we build engineering projects is not automated, to modify one line of code must be compiled, which is a very troublesome thing, we need to automate the compilation, this time you need to start the service, with webpack-dev-server plug-ins

webpack3 upgrade webpack4

VUE-cli -g install npm
VUE project name and the init webpack has been the default
cd project name
npm run dev (normal interface to indicate success) to view the version number of webpack package.json, the version upgrade is 3 to 4 npm install after you'll find webpack @ ^ 4 -D run after an error, so we have to be handled according to error contents, because webpack upgrade, that webpack-dev-server also need to upgrade to the latest npm install webpack-dev-server @ latest -D run error, suggesting you webpack-cli not installed cnpm install webpack-cli @ latest -D run newspaper html-webpack-plugin wrong cnpm install html-webpack-plugin @ latest -D run eslint-loader error cnpm install eslint-loader @ latest report -D run newspaper vue-loader error
CNPM install vue-loader @ Latest -D
CNPM install CSS-Loader @ Latest -D
CNPM install postcss @ Latest -D-Loader
Here Insert Picture Description

Here Insert Picture Description
Operation will be successful again

When packing back to find an error, because webpack.optimize.CommonsChunkPlugin No, look here , add the corresponding code in webpack.prod.conifg.js
Here Insert Picture Description
the corresponding CommonsChunkPlugin commented
cnpm install extract-text-webpack- plugin @ next - D

If you have been reported this error

Here Insert Picture Description
Global search minRemainingSize remove these lines of code

Here Insert Picture Description
We will contenthash into hash search contenthash

This package was successful

Published 42 original articles · won praise 4 · Views 6099

Guess you like

Origin blog.csdn.net/qq_43427385/article/details/103761833
Recommended