Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
preconnect-html-webpack-plugin
Advanced tools
A webpack plugin for injecting <link rel="preconnect"> into HtmlWebpackPlugin pages
This extension plugin embeds <link rel="preconnect">
tags into HTML files generated by the HtmlWebpackPlugin. Supported in Webpack 3/4, html-webpack-plugin 3/4
使用 npm 或者 yarn
$ npm install --save-dev preconnect-html-webpack-plugin
在 webpack config 中添加插件:
const PreconnectHtmlWebpackPlugin = require('preconnect-html-webpack-plugin')
...
plugins: [
// set the preconnect origins
new PreconnectHtmlWebpackPlugin(['//test.a.com', '//test.b.com'])
]
结合 html-webpack-plugin,它会自动在 html 注入你需要的配置
注意: 请把
preconnect-html-webpack-plugin
放在html-webpack-plugin
插件后面使用
<link rel="preconnect" href="//test.a.com">
<link rel="preconnect" href="//test.b.com">
const PreconnectHtmlWebpackPlugin = require('preconnect-html-webpack-plugin')
...
entry: {
test1: './src/test1.js',
test2: './src/test2.js'
},
plugins: [
new HtmlWebpackPlugin({
filename: 'test1.html',
title: 'test1',
template: './index.html',
preconnect: [
{
url: '//test.a.com',
crossorigin: true
}
]
}),
new HtmlWebpackPlugin({
filename: 'test2.html',
title: 'test2',
preconnect: [
{
url: '//test.a.com',
crossorigin: true
},
'//test.b.com'
]
}),
new PreconnectHtmlWebpackPlugin()
]
new PreconnectHtmlWebpackPlugin()
中配置的属性将作用于所有 html 页面,并且优先级要高于 HtmlWebpackPlugin 中配置的 preconnect 属性
FAQs
A webpack plugin for injecting <link rel="preconnect"> into HtmlWebpackPlugin pages
The npm package preconnect-html-webpack-plugin receives a total of 2 weekly downloads. As such, preconnect-html-webpack-plugin popularity was classified as not popular.
We found that preconnect-html-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.