怎么使用webpack 进行打包
需要使用管理员权限进行安装
-
npm install webpack -g
-
npm install webpack-cli -g
-
创建站点 mkdir webpack
-
进入站点 cd webpack
-
npm init 创建package.json 文件
-
npm install --save-dev webpack 下载node_modules文件夹
-
npm install webpack-cli --save //安装webpack脚手架
-
webpack ./src/main.js -o ./dist/bundle.js --mode development
- webpack --mode development
- webpack --mode production
这两个模式区别,开发模式代码不会压缩,生产模式代码会被压缩