Gathering detailed insights and metrics for prefetch-polyfill-webpack-plugin
Gathering detailed insights and metrics for prefetch-polyfill-webpack-plugin
Gathering detailed insights and metrics for prefetch-polyfill-webpack-plugin
Gathering detailed insights and metrics for prefetch-polyfill-webpack-plugin
Prefetch polyfill plugin for webpack async chunks to imporve load time (on safari)
npm install prefetch-polyfill-webpack-plugin
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
46 Stars
11 Commits
2 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Aug 15, 2023
Latest Version
0.2.0
Package Id
prefetch-polyfill-webpack-plugin@0.2.0
Size
3.37 kB
NPM Version
5.4.2
Node Version
8.5.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This plugin automatically wire up your async thunks with a prefetch polyfill function(using new Image().src or <script async>
) for platform which doesn't support <link rel='prefetch'>
, such as safari, to improve load time.
This is an extension plugin for html-webpack-plugin.
The prefetch polyfill function will be injected before </body>
.
1<!-- as default it use new Image().src --> 2<script> 3 (function(){ 4 var ua = (typeof navigator !== 'undefined' ? navigator.userAgent || '' : '') 5 if(/safari|iphone|ipad|ipod|msie|trident/i.test(ua) && !/chrome|crios|crmo|firefox|iceweasel|fxios|edge/i.test(ua)) { 6 window.onload = function () { 7 var i = 0, length = 0, 8 preloadJs = ['/chunk.a839f9eac501a92482ca.js', ...your thunks] 9 10 for (i = 0, length = preloadJs.length; i < length; i++) { 11 new Image().src = preloadJs[i] 12 } 13 } 14 } 15 })() 16</script> 17 18<!-- you can choose to use <script async> --> 19<script> 20(function(){ 21 var ua = (typeof navigator !== 'undefined' ? navigator.userAgent || '' : '') 22 if(/safari|iphone|ipad|ipod|msie|trident/i.test(ua) && !/chrome|crios|crmo|firefox|iceweasel|fxios|edge/i.test(ua)) { 23 window.onload = function () { 24 var i = 0, length = 0, js, 25 preloadJs = ['/chunk.a839f9eac501a92482ca.js', ...your thunks] 26 27 for (i = 0, length = preloadJs.length; i < length; i++) { 28 js = document.createElement('script') 29 js.src = preloadJs[i] 30 js.async = true 31 document.body.appendChild(js) 32 } 33 } 34 } 35})() 36</script>
1npm install prefetch-polyfill-webpack-plugin --save-dev
In webpack config, require the plugin:
1const PrefetchPolyfillPlugin = require('prefetch-polyfill-webpack-plugin');
and add this plugin after HtmlWebpackPlugin:
1plugins: [ 2 new HtmlWebpackPlugin(), 3 new PrefetchPolyfillPlugin() 4]
This plugin works well with preload-webpack-plugin. If you are using code splitting you are recommended to use both plugin at the same time.
Set mode to async
to use <script async>
to prefetch, or use new Image().src
as default.
1plugins: [ 2 new HtmlWebpackPlugin(), 3 new PrefetchPolyfillPlugin({ 4 mode: 'async' 5 }) 6]
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
92 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More