variance in ts

上次面试,问到了 ts 的协变、逆变,没有回答上来。。。下来后查了相关文档,发现很多文章都说的不清楚,所以打算写一下自己的理解作为迟来的答案。 See also

Vite

vite 核心代码分为3大块 server 插件 依赖预构建 server 本文使用 koa 搭建服务器,源码简化如下 function createServer(options) { const config = { root: process.cwd(), ...options, plugins: [ ...builtInPlugins, ...options.plugins, ] } // -- 创建 server 实例 const app = new Koa() // -- 插件容器

Vue3 nextTick/effectScope

nextTick 问题:更新响应式数据,并不能立即获取到最新的DOM <div id="foo">hello, {{ name }}</div> const name = ref('world') setTimeout(() => { name.value = 'sky' console.log('updated', document.querySelector('#foo').innerHTML) // hello, world }, 2000) 解决方法:使用 nextTick() const name = ref('world') setTimeout(() => { name.value = 'sky' nextTick(() => { console.log('updated',

《Micro Frontends in Action》

Introduction what Micro frontends are not a concrete technology. They’re an alternative organizational and architectural approach for scaling development. Teams can work autonomously in their field of expertise. Teams can choose the technology stack that fits best for the job at hand. The applications are loosely coupled and only integrate in the frontend (e.g., via links). how routing 指页面之间的

Modules

Module 模块的作用 类似命名空间的上下文隔离,避免各个功能模块间的变量冲突 支持模块间的引用即依赖,避免把需要用到的变量、方法等提升到全局作用域 主流方