2019.05.08
5.9 - 5.12 早报更新时间不定,有可能出现停更,提前跟大家请个假,不要祸害我的 Issue 啦
[文章] 《Tree-Shaking 性能优化实践 - 原理篇》Vue 3.0 包的缩减就是用 Tree-Shaking 昨天的视频有介绍:https://juejin.im/post/5a4dc842518825698e7279a9
[文章] 《多页应用 Webpack4 配置优化与踩坑记录》:https://segmentfault.com/a/1190000016685119
[类库] Vue 剪贴板类库,通过一条指令,就能方便的实现该功能:https://github.com/euvl/v-clipboard
[教程] 高级 React Hooks 的使用技巧:https://github.com/kentcdodds/advanced-react-hooks
useReducer
: simple CounteruseReducer
: HTTP requestsuseContext
: simple Counter (coversuseMemo
anduseCallback
as well)useContext
: Caching response data in context (coversuseMemo
anduseCallback
as well)useLayoutEffect
: auto-growing textareauseImperativeHandle
: scroll to top/bottomuseDebugValue
: useMedia
配图 - Tree-Shaking 性能优化实践
示例 - 多页应用 Webpack4 配置优化与踩坑记录 - splitChunks
const commonOptions = {
chunks: 'all',
reuseExistingChunk: true
}
export default {
namedChunks: true,
moduleIds: 'hashed',
runtimeChunk: {
name: 'manifest'
},
splitChunks: {
maxInitialRequests: 5,
cacheGroups: {
polyfill: {
test: /[\\/]node_modules[\\/](core-js|raf|@babel|babel)[\\/]/,
name: 'polyfill',
priority: 2,
...commonOptions
},
dll: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: 'dll',
priority: 1,
...commonOptions
},
commons: {
name: 'commons',
minChunks: Math.ceil(pages.length / 3), // 至少被1/3页面的引入才打入common包
...commonOptions
}
}
}
}
示例 - Vue 剪贴板类库,通过指令的方式操作
<button v-clipboard="value">
Copy to clipboard
</button>