Socket
Socket
Sign inDemoInstall

webpack-inline-manifest-plugin

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-inline-manifest-plugin

inline your Webpack manifest.js with a script tag to save http request


Version published
Weekly downloads
5.2K
increased by3.27%
Maintainers
1
Weekly downloads
 
Created
Source

CircleCI js-standard-style npm npm npm

Webpack Inline Manifest Plugin

This is a webpack plugin that inline your manifest.js with a script tag to save http request. Cause webpack's runtime always change between every build, it's better to split the runtime code out for long-term caching.

Installation

Install the plugin with npm:

$ npm i webpack-inline-manifest-plugin -D

Basic Usage

This plugin need to work with HtmlWebpackPlugin v2.10.0 and above:

Step1: split out the runtime code

// for explicit vendor chunk config
[
	new webpack.optimize.CommonsChunkPlugin({
		names: ['vendor', 'manifest']
	})
]

// or specify which chunk to split manually
[
	new webpack.optimize.CommonsChunkPlugin({
		name: 'manifest',
        chunks: ['...']
	})
]

Step2: config HtmlWebpackPlugin:

[
	new HtmlWebpackPlugin({
		template: './index.ejs'
	})
]

Step3: config WebpackInlineManifestPlugin

  • name: default value is webpackManifest, result in htmlWebpackPlugin.files[name], you can specify any other name except manifest, beacuse the name manifest haved been used by HtmlWebpackPlugin for H5 app cache manifest.

Call:

const WebpackInlineManifestPlugin = require('webpack-inline-manifest-plugin');

Config:

[
	new WebpackInlineManifestPlugin({
		name: 'webpackManifest'
	})
]

Finally in HTML:

<!-- index.ejs -->
<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title>App</title>
</head>
<body>


<%=htmlWebpackPlugin.files.webpackManifest%>

</body>
</html>

Done!

Keywords

FAQs

Package last updated on 22 Mar 2018

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

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