New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

html-prefetch-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-prefetch-webpack-plugin

如果你想在浏览器空闲时段加载一些较大的资源,那么你可以使用此插件

latest
Source
npmnpm
Version
1.1.2
Version published
Weekly downloads
2
-89.47%
Maintainers
1
Weekly downloads
 
Created
Source

node npm GitHub forks GitHub stars GitHub issues GitHub last commit

Html Prefetch Webpack Plugin

If you want to load some large resources during the browser's idle time, you can use this plugin. Prefetch works for non-first screen loading; Preload applies to the first screen loading

如果你想在浏览器空闲时段加载一些较大的资源,那么你可以使用此插件,prefetch适用于非首屏加载;preload适用于首屏加载

Install

npm i html-prefetch-webpack-plugin -D
# or
yarn add html-prefetch-webpack-plugin -D

Example

before:

<!doctype html>
<html>

<head>
   <meta charset="utf-8">
   <title>Webpack App</title>
   <meta name="viewport" content="width=device-width,initial-scale=1">
   <script defer="defer" src="./main.025b57ab4efabca2e393.js"></script>
</head>

<body></body>

</html>

after:

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>Webpack App</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <script defer="defer" src="./main.025b57ab4efabca2e393.js"></script>
+    <link as="script" href="./big-file.e4cd65aaa70ad26eba0d.js" rel="prefetch">
</head>

<body></body>

</html>

webpack config

const HtmlPrefetchWebpackPlugin = require('html-prefetch-webpack-plugin')
   plugins:[
    new htmlWwebpackPlugin(),
+   new HtmlPrefetchWebpackPlugin({
+       rel:'prefetch',
+       include:['big-file']
+  })
   ]

options

key(键)value(值)Default(默认值)Description(备注)
rel'prefetch' or 'preload'nullSpecify the type
includestring[]nullChunk file names that need to be preread and preloaded

Keywords

webpack

FAQs

Package last updated on 30 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts