https://github.com/sjinks/hwp-inline-runtime-chunk-plugin
Plugin to inline WebPack runtime chunks when using html-webpack-plugin
https://github.com/sjinks/hwp-inline-runtime-chunk-plugin
html-webpack-plugin html-webpack-plugin-plugin inline runtime-chunk webpack-plugin
Last synced: 10 months ago
JSON representation
Plugin to inline WebPack runtime chunks when using html-webpack-plugin
- Host: GitHub
- URL: https://github.com/sjinks/hwp-inline-runtime-chunk-plugin
- Owner: sjinks
- License: mit
- Created: 2020-09-06T05:36:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-03T06:22:36.000Z (12 months ago)
- Last Synced: 2025-03-05T05:02:22.293Z (11 months ago)
- Topics: html-webpack-plugin, html-webpack-plugin-plugin, inline, runtime-chunk, webpack-plugin
- Language: TypeScript
- Homepage:
- Size: 2.89 MB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hwp-inline-runtime-chunk-plugin
[](https://github.com/sjinks/hwp-inline-runtime-chunk-plugin/actions/workflows/build.yml)
This plugin automatically inlines Webpack's runtime chunks. It requires [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin)
This plugin was inspired by [html-webpack-inline-runtime-plugin](https://github.com/chippers/html-webpack-inline-runtime-plugin) and does pretty much the same but differently.
There are a few differences, though:
* hwp-inline-runtime-chunk-plugin does *not* calculate integrity hashes (and therefore does not inject the CSP meta tag): the plugin must do one thing and do it well.
* hwp-inline-runtime-chunk-plugin has an option (off by default) to strip the source map from the inlined runtime chunk.
* hwp-inline-runtime-chunk-plugin tries to handle all corner cases and has an extensive test suite.
## Installation
```bash
npm install --save-dev hwp-inline-runtime-chunk-plugin
```
## Usage
```javascript
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { HwpInlineRuntimeChunkPlugin } = require('hwp-inline-runtime-chunk-plugin');
module.exports = {
optimization: {
runtimeChunk: 'single'
},
plugins: [
new HtmlWebpackPlugin(),
new HwpInlineRuntimeChunkPlugin({ removeSourceMap: true })
]
};
```
The plugin currently has only one configuration option:
* `removeSourceMap` (Boolean, the default is `false`): whether to remove the link to the source map from the inlined source