The first article —


Webpack can’t handle vue files by default, so we had to add some extra plug-ins to handle it ourselves.

Solution: Step 1: Install the plug-in

cnpm i vue-loader vue-template-compiler --save-dev 
Copy the code

Step 2: Add the following configuration to webpack.config.js:

 module: {
        rules: [{test: /\.vue$/.use: {
             	loader: 'vue-loader']}}},Copy the code


Then run it again. If an error is reported, it may be due to the vue-loader version. Your version is too high.

We can solve this problem in two ways:

Method 1: Reduce the vuE-Loader version

Reduce the vue-loader version below 14.0.0.

CNPM [email protected] - I save - devCopy the code

Method 2: Add additional configuration to webpack.config.js.

/ / incoming vue - loader/lib/plugin
const VueLoaderPlugin = require('vue-loader/lib/plugin');

module.exports  = {
    plugins: [   
        new VueLoaderPlugin()
    ],
    module: {
        rules: [{test: /\.vue$/.use: {
             	loader: 'vue-loader'}},]}};Copy the code