Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefetch 与 preload #75

Open
jyzwf opened this issue Apr 20, 2019 · 0 comments
Open

prefetch 与 preload #75

jyzwf opened this issue Apr 20, 2019 · 0 comments

Comments

@jyzwf
Copy link
Owner

jyzwf commented Apr 20, 2019

为啥会有这个话题呢?还是前面在做路由按需加载的时候遇到的,前面说到过实现路由懒加载的是依赖 webpackmagic comments。但我并没有设置其 webpackPrefetch/webpackPreload。可它页面中却出现了这些代码。

image

同时可以在请求里面可以看到一个之前没见过的字段:Purpose

image

这就很好奇了,我代码中并没有配啊,然后去找了一下,发现实这段代码的问题,导致了出现了prefetch,这里的 PreloadPlugin@vue/preload-webpack-plugin

carbon (6)

然后就去找了 prefetch/preload 的周边。关于 prefetch 在mdn 上的介绍,详见:Link prefetching ,以及 通过rel="preload"进行内容预加载
后面又去网上搜了搜,发现一篇比较好的文章,在webpack中使用prefetch/preload,这是一篇翻译文 ,英文原文为 <link rel=”prefetch/preload”> in webpack(注:自备梯子),由webpack 核心开发者所写,可以拜读一番,以及 前端性能优化 - 资源预加载。完~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant