前端的新“轮子”:JavaScript 应用打包器 Fastpack
source link: http://www.10tiao.com/html/146/201807/2650082427/2.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
授权协议:MIT
开发语言:JavaScript
操作系统:跨平台
Fastpack 是一个 JavaScript 应用打包器,目标是做到对于中型应用(约1000个模块)的打包时间小于1000ms,增量重新打包时间低于100ms。
$ npm install -g fpack
$ fpack --help
基准测试结果
示例代码
$ fpack ./ui/index.js \
-o build \
-w \
--dev \
--nm "$(pwd)/node_modules" \
--nm node_modules \
--preprocess='^ui/.+\.js$' \
--preprocess='^node_modules/components/[^/]+\.js$'
Packed in 2.148s. Bundle: 5.87Mb. Modules: 1602. Cache: empty. Mode: development.
Watching file changes (Ctrl+C to stop)
$ fpack ./ui/index.js \
-o build \
-w \
--dev \
--nm "$(pwd)/node_modules" \
--nm node_modules \
--preprocess='^ui/.+\.js$' \
--preprocess='^node_modules/components/[^/]+\.js$'
Packed in 0.176s. Bundle: 5.87Mb. Modules: 1602. Cache: used. Mode: development.
Watching file changes (Ctrl+C to stop)
安装
通过以下 npm 安装:
% npm install fpack
使用
生成开发包
% fpack --development ./index.js
生成生产包
% fpack ./index.js \
--postprocess 'babel --presets env' \
--postprocess 'uglify -cm'
请注意,必须安装 babel,babel-preset-env 和 uglify-js 软件包。
项目详情及源码地址获取:
大变样,Chrome 新一代 Material Design UI 来袭
Python 之父宣布退出决策层,Python 该何去何从?
了解最新开源资讯
获取热门开源项目
学习优秀技术干货
还有戏精剧场等你
资讯 | 软件 | 干货 | 翻译
开源中国
ID:oschina2013
点击“阅读原文”查看更多精彩内容Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK