3_CommonJS-Browserify模块化教程

时间:2020-06-16 18:51:30   收藏:0   阅读:59

CommonJS 浏览器端模块化教程

1. 创建项目结构

|-js
  |-dist //生成编译完js的目录
  |-src //源码所在的目录(我们编写的、没经过工具处理的代码,叫做源码)
    |-module1.js
    |-module2.js
    |-module3.js
    |-main.js
|-index.html

2. 模块化编码

3. 下载 browserify

4. 执行处理命令

5. 页面使用引入:

<script type="text/javascript" src="js/dist/bundle.js"></script> 
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!