前端学习案例-vue2源码解析1-数据劫持

安装

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")
    })]
}

posted @ 2022-08-20 21:55  前端导师歌谣  阅读(26)  评论(0)    收藏  举报