前端学习案例-vue2源码解析1-数据劫持
原创
©著作权归作者所有:来自51CTO博客作者前端导师歌谣的原创作品,请联系作者获取转载授权,否则将追究法律责任
安装
npm init -y
安装依赖
yarn add webpack webpack-cli webpack-dev-server
yarn add html-webpack-plugin
配置webpack.config.js
const path=require("path"),
// 解析html
HtmlWebpackPlugin=require('html-webpack-plugin')
module.exports={
//模式
mode:"production",
entry:"./src/index.js",
// 打包路径
output:{
filename:"bundle.js",
path:path.resolve(__dirname,"dist")
},
devtool:"source-map",
// 默认寻找位置
resolve:{
modules:[path.resolve(__dirname,""),path.resolve(__dirname,"node_modules")]
},
// 解析html
plugins:[new HtmlWebpackPlugin({
template:path.resolve(__dirname,"public/index.html")
})]
}