美文网首页
2019-05-21

2019-05-21

作者: 关耳木南 | 来源:发表于2019-05-21 11:23 被阅读0次
let path = require('path');
let htmlWebpackPlugin = require('html-webpack-plugin');
let VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
  entry:'./src/main.js',
  output:{
    filename:'bundle.js',
    path:path.resolve('./dist')
  },
  module:{
    rules:[
      //模块解析规则
      //匹配所有的js,用babel-loader转义,排除node_modules
      {test:/\.js$/,use:'babel-loader',exclude:/node_modules/},
      {test:/\.css$/,use:['style-loader','css-loader']},
      {test:/\.less$/,use:['style-loader','scc-loader','less-loader']},
      //转换base64只在8192字节下转化。其他情况下输出图片
      {test:/\.(jpg|gif|png)$/,use:'url-loader?limit=8192'},
      //配置一些小图标单独写
      // {test:/\.(eot|svg|woff|woff2|wtf)$/,use:'url-loader'},
      {test:/\.vue$/,use:'vue-loader'}
    ]
  },
  plugins:[
    new htmlWebpackPlugin({
      template:'./src/index.html'
    }),
     new VueLoaderPlugin()
  ]
}

相关文章

网友评论

      本文标题:2019-05-21

      本文链接:https://www.haomeiwen.com/subject/idmdzqtx.html