首页 > Web开发 > 详细

Vue Vue-loader / VueLoaderPlugin / Webpack

时间:2021-04-10 00:56:14      阅读:19      评论:0      收藏:0      [点我收藏+]

在不用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自带的插件,修改webpack.config.js的内容,如下图红色标记

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

Vue Vue-loader / VueLoaderPlugin / Webpack

原文:https://www.cnblogs.com/henuyuxiang/p/14637050.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!