webpack初体验
2020-04-27 本文已影响0人
云小泽同学
1、新建一个webpack项目目录,名字可以按照自己的需求取

2、yarn init -y

3、yarn add webpack webpack-cli -D

4、然后在webpack的目录下创建src/index.js文件,并编辑放入以下内容
console.log("hello,wbpack")
5、打包,这里也顺便使用了npx,如未安装,就请先安装

6、打包后会产生一个dist/main.js文件,可以使用run code运行文件(使用了vscode中的插件:Code Runner)


