Skip to content

Instantly share code, notes, and snippets.

@xiaogdgenuine
xiaogdgenuine / Prefetcher.js
Last active February 10, 2020 05:07
A babel plugin for take prefetch control from webpack (Just a prove of concept)
export class Prefetcher {
static manifest = {
"pageA.js": "/pageA.hash.js",
"pageA.css": "/pageA.hash.css",
"app.js": "/app.hash.js",
"index.html": "/index.html"
}
static function prefetch(chunkId, chunkExtension, as) {
const link = document.createElement('link')
link.rel = "prefetch"