New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html_webpack_plugin_alter_asset_mount-stzhang

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html_webpack_plugin_alter_asset_mount-stzhang - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

7

libs/index.js

@@ -45,3 +45,8 @@ const pkg = require('../package.json');

const {js, css} = mount[chunkName];
const chunk = chunks.find(({id, names}) => id === chunkName || ~names.indexOf(chunkName));
const chunk = chunks.find(({id, names, idHints, runtime}) => {
if (plugin.version >= 4) {
return idHints.map(id => `${id}~${runtime.join('~')}`).some(id => id === chunkName);
}
return id === chunkName || ~names.indexOf(chunkName);
});
if (chunk) {

@@ -48,0 +53,0 @@ let index;

2

package.json
{
"name": "html_webpack_plugin_alter_asset_mount-stzhang",
"version": "1.0.1",
"version": "1.0.2",
"description": "微调 html-webpack-plugin 插件注入 script 标签在html模板内的位置",

@@ -5,0 +5,0 @@ "main": "libs/index.js",

@@ -39,9 +39,9 @@ # html_webpack_plugin_alter_asset_mount-stzhang

inject: true,
chunks: ['entry1', 'entry2'],
chunks: ['chunkId1', 'chunkId2'],
mount: { // 新配置项在这里。
entry1: { // chunk 名 或者 chunk id
chunkId1: { // chunk 名 或者 chunk id
js: 'body' | 'head', // 指定此 chunk 的脚本文件放在哪
css: 'body' | 'head' // 指定此 chunk 的样式文件放在哪
}
// 注意:entry2 没有出现在 mount 配置里。所以,`inject: true`
// 注意:chunkId2 没有出现在 mount 配置里。所以,`inject: true`
// 让把它的程序文件放在哪,就放在那。和`HtmlWebpackPlugin`插件

@@ -53,2 +53,6 @@ // 的原有行为保持一致。

#### `chunkId`的数据格式
**在`HtmlWebpackPlugin v4+`中,**其的格式是`{Chunk Id hint}~{Entry Point 1}~{Entry Point 2}~...`
## 安装

@@ -63,3 +67,3 @@

plugins: [
new AlertAssetMount() // 上面配置中的 {mount: {entry1: {js, css}}} 配置对象
new AlertAssetMount() // 上面配置中的 {mount: {chunkId1: {js, css}}} 配置对象
// 出现在构造函数参数里也是可以的。但,注意优先级更低

@@ -66,0 +70,0 @@ ]

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc