webpack-inline-manifest-plugin
inline your Webpack manifest.js with a script tag to save http request
Last updated 2 years ago by almothafar .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install webpack-inline-manifest-plugin 
SYNC missed versions from official npm registry.

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!

Current Tags

  • 4.0.1                                ...           latest (2 years ago)

2 Versions

  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 2
Last Day 1
Last Week 11
Last Month 43
Dependencies (1)
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |