学习笔记–Webpack(Learning notes — webpack)

 一、Webpack基本使用–安装和配置

① 新建一个空目录并进入该目录,执行命令 npm init -y 来初始化 package.json 包管理配置文件.

② 执行命令 npm install webpack webpack-cli -D  来安装相关包

③ 在项目根目录中创建名为 webpack.config.js 的配置文件

该配置文件初始化内容如下:

// webpack.config.js

module.exports={
    mode: 'development' //开发模式development 生产模式 
}
————————

I. basic use of webpack — installation and configuration

① Create an empty directory and enter it. Execute the command NPM init – y to initialize the package JSON package management configuration file

② Execute the command {NPM install webpack webpack cli – D} to install related packages

③ In the root directory of the project, create a file named webpack.com config. JS configuration file

The initialization contents of the configuration file are as follows:

// webpack.config.js

module.exports={
    mode: 'development' //开发模式development 生产模式 
}