zoukankan      html  css  js  c++  java
  • Vue Vue-loader / VueLoaderPlugin / Webpack

    在不用VueCli创建项目的时候,手写引入vue的时候,配置webpack的时候发现了这个问题
    webpack vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin

    这是因为在15.x.x版本之后,如果要使用vue-loader,需要在webpack种使用vue-loader自带的插件

    VueLoaderPlugin

    const path = require('path') // node内置模块
    const HtmlWebpackPlugin = require('html-webpack-plugin')
    const VueLoaderPlugin = require('vue-loader/lib/plugin')
    const config = {
      mode: 'none',
      entry: './src/main',
      output: {
        filename: 'bundle.js',
      },
      module: {
        rules: [
          //....
          {
            test: /.vue$/,
            use: ['vue-loader']
          }
        ],
      },
      plugins: [
        new HtmlWebpackPlugin({
          title: 'Webpack Plugin Sample',
          template: './src/index.html'
        }),
        new VueLoaderPlugin()
      ]
    }
    module.exports = config
    
    Keep learning
  • 相关阅读:
    MongoDB小结07
    MongoDB小结07
    MongoDB小结06
    MongoDB小结05
    MongoDB小结04
    MongoDB小结03
    MongoDB小结02
    MongoDB小结01
    this与super
    UVa 11174
  • 原文地址:https://www.cnblogs.com/leslie1943/p/13358224.html
Copyright © 2011-2022 走看看