profile 概览
¶本文总结了一些首屏加载优化的webpack实践, 分为如下几个模块
- bundle analysis 打包分析
- code coverage 代码覆盖率
- magic comments 魔法注释
- prefeching/preloading 预加载
- code splitting 代码分割
- lazy loading 懒加载(按需加载)
- babel, babel-polyfill与babel-runtime
- tree shaking 摇树
- sourcemap 源码映射配置
a little boy picking up shells
官方文档: https://www.w3.org/das/
官方文档: https://www.w3.org/TR/vibration/
参考文档: https://www.sitepoint.com/the-buzz-about-the-vibration-api/
compatibility: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate
亲测微信小程序webview支持
https://www.audero.it/demo/vibration-api-demo.html
1 | window.navigator.vibrate(1000) |
官方文档: https://www.w3.org/TR/battery-status/
compatibility: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getBattery#Browser_compatibility
亲测微信小程序webview支持
1 | $ npm i -S ts-polyfill |
1 | import 'ts-polyfill' |
1 | $ export PUB_HOSTED_URL=https://pub.flutter-io.cn |
一个模块打包器(能识别ES Moudule和CommonJS规范和其他如css等格式的文件)
1 | { |
1 | $ npm init -y # 用默认配置初始项目 |
现象: push代码时gitlog出现 remote: HTTP Basic: Access denied
原因: git仓库设置了权限, You won’t be able to pull or push project code via HTTPS until you create a personal access token on your account(大白话: 无法使用HTTPS协议)
解决方案: 修改远程仓库地址为ssh协议的地址
具体操作如下:
1 | # 两种方法 |
1 | $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
1 | $ brew install node |
1 | // webpack配置 |