vite配置学习

  1. hot.accept,开发环境守卫,生产环境就不读取这段
    if (import.meta.hot) {
    import.meta.hot.accept(‘./foo.js’, (newFoo) => {
    newFoo.foo();
    });
    //import.meta.hot.accept();
    }

在这里插入图片描述
2.dispose清理有副作用函数 clearInterval(timer)

cache // 缓存丢弃前的变量

invalidate // 刷新页面

decline // 页面刷新
// import.meta.hot.accept() // update
// import.meta.hot.decline() // reload

猜你喜欢

转载自blog.csdn.net/hkduan/article/details/126810842