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

@ysfe/inject-only-html-webpack-plugin

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ysfe/inject-only-html-webpack-plugin

webpack plugin: 仿 html-webpack-plugin, 将js转化为 <script> 注入到html中

latest
npmnpm
Version
1.2.1
Version published
Weekly downloads
1
Maintainers
4
Weekly downloads
 
Created
Source

@ysfe/inject-only-html-webpack-plugin

webpack plugin: 仿 html-webpack-plugin, 将 js 转化为

前置依赖

  • webpack >= 5.0.0

使用方式

  • 安装: yarn add @ysfe/inject-only-html-webpack-plugin --dev

  • 使用:

    import InjectOnlyHtmlWebpackPlugin from '@ysfe/inject-only-html-webpack-plugin'
    
    // in webpack.config.js
    module.exports = {
      plugins: [
        new InjectOnlyHtmlWebpackPlugin({ /* ... */ })
      ]
    }
    
  • 参数说明

    uglify 参考: html-minifier-terser

    参数类型描述可选
    outputstring输出文件名
    templatestringhtml 模板路径 or html 模板内容
    chunksstring / Array需要加载哪些入口
    scriptTag{charset?:string; defer?:boolean}自定义 script 属性

实现方案

  • 参考 html-webpack-plugin 实现, 将 js 打包到 html 中.

注意事项

[其他说明事项]

版本说明

Keywords

html-webpack-plugin

FAQs

Package last updated on 17 Jun 2021

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