Go to file
shenjianZ ed728f66d3 update 2024-07-26 12:45:28 +08:00
01 update 2024-07-26 12:45:28 +08:00
.gitignore init... 2024-07-26 11:15:42 +08:00
LICENSE Initial commit 2024-07-26 03:12:47 +00:00
README.md update 2024-07-26 12:45:28 +08:00

README.md

buiildToolStudy

初始化项目

npm init -y

安装webpack依赖开发依赖

npm add -D webpack webpack-cli

打包项目

npx webpack

entery 入口文件

入口文件是webpack的起点通过入口文件来找到项目中的所有依赖模块。

module.exports = {
    entry: './src/index.js', //默认值
    entry"./hello/hello.js", // 修改默认值
    entry: ["./src/a.js", "./src/b.js"], // 多个入口文件
    entry: {
      hello: "./src/a.js",
      b: "./src/b.js"
    } // 多个入口文件,使用对象形式
}

output 出口文件

出口文件是webpack打包后输出的文件。

module.exports = {
    output: {
        filename: "bundle.js", // 默认值
        clean: true, // 清除打包文件所在目录
        path: `${__dirname}/dist/dist` // 指定打包后的文件路径
    }
}