npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

html-webpack-entry-plugin

v0.0.2

Published

a plugin for html-webpack-plugin to mange your entry!

Downloads

2

Readme

html-webpack-entry-plugin

A html-webpack-plugin component that supports multiple entrypoint resource file splits.

一个html-webpack-plugin的组件,支持多entrypoint的资源文件拆分。

Installation

npm i html-webpack-entry-plugin
yarn add html-webpack-entry-plugin

Dependencies

webpack >= 4.0.0

html-webpack-plugin >= 4.0.0

node >= 6.0.0

Example Webpack Config

webpack config

{
    mode:"production",
    module:{
        rules: [{
            test: /\.js$/,
            exclude: /node_modules/,
            loader: "babel-loader"
        },
        {
            // css资源
            test: /\.(scss|css)$/,
            use: [{
                    loader: MiniCssExtractPlugin.loader,
                },
                {
                    loader: "css-loader"
                },
                {
                    loader:"postcss-loader"
                },
                {
                    loader:"sass-loader"
                }
            ]
        }
    },
    output:{
        path: path.resolve(__dirname, '..', 'assets'),
        filename: "js/[name]-[chunkhash:6].js",
        publicPath: 'http://test.sina.com.cn/'
    },
    optimization:{
        runtimeChunk: {
            name: "manifest"
        },
        splitChunks:{
            //js默认最大初始化并行请求数字
            maxInitialRequests:4,
            chunks: 'initial',
            cacheGroups: {
                vendors: {
                    name:'vendors',
                    test: /[\\/]node_modules[\\/]/,
                    priority: -10
                }
            }
        },
    },
    entry:{
        index:"./index.js",
        next:"./next.js",
        other:"./other.js"
    },
    plugins:[
        new HtmlWebpackPlugin({
            minify:false,
            template: "filePath",
            filename: 'index.html'//this filename need same as entrypoint 这里要求filename与entry中定义的名字相同
        }),
        new HtmlWebpackPlugin({
            minify:false,
            template: "filePath",
            filename: 'next.html'//this filename need same as entrypoint 这里要求filename与entry中定义的名字相同
        }),
        new HtmlWebpackPlugin({
            minify:false,
            template: "filePath",
            filename: 'other.html'//this filename need same as entrypoint 这里要求filename与entry中定义的名字相同
        }),
        new HtmlWebpackEntryPlugin()
    ]
}    

output:

index.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        
        <script src="http://test.sina.com.cn/js/manifest-65c668.js"></script>
        <script src="http://test.sina.com.cn/js/vendors-7dffe1.js"></script>
        <script src="http://test.sina.com.cn/js/index-6eef73.js"></script>
    </body>
    </html>

next.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        
        <script src="http://test.sina.com.cn/js/manifest-65c668.js"></script>
        <script src="http://test.sina.com.cn/js/vendors-7dffe1.js"></script>
        <script src="http://test.sina.com.cn/js/next-7dca45.js"></script>
    </body>
    </html>

next.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        
        <script src="http://test.sina.com.cn/js/manifest-65c668.js"></script>
        <script src="http://test.sina.com.cn/js/vendors-7dffe1.js"></script>
        <script src="http://test.sina.com.cn/js/next-7dca45.js"></script>
    </body>
    </html>

other.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        
        <script src="http://test.sina.com.cn/js/manifest-65c668.js"></script>
        <script src="http://test.sina.com.cn/js/next-66eecc.js"></script>
    </body>
    </html>

the index.js and next.js all include the same moudule.

but other.js not, so it not have vendors.js

在index.js与next.js中引用了相同的模块,公共的模块会抽取到vendors.js中。而other.js没有引用相同的模块。

所以index.html以及next.html中都有vendors.js的引用,但是到了other.html中,没有这个模块。

Usage

    {
        plugins:[
            new HtmlWebpackEntryPlugin()
        ]
    }

TODO

suport meta tags