esi-webpack-plugin

A Webpack plugin to resolve ESI includes

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
esi-webpack-plugin
717.1.02 months ago5 years agoMinified + gzip package size for esi-webpack-plugin in KB

Readme

esi-webpack-plugin
A Webpack plugin to resolve ESI includes.

Useful in development in conjunction with html-webpack-plugin to resolve ESI includes (using nodesi) in all emitted HTML files.

Install

npm install --save-dev esi-webpack-plugin

Usage

Options map more or less directly to the options provided by nodesi:
const HtmlWebpackPlugin = require('html-webpack-plugin')
const EsiWebpackPlugin = require('esi-webpack-plugin')

module.exports = {
  // ...
  plugins: [
    new HtmlWebpackPlugin(),
    new EsiWebpackPlugin({
      baseUrl: 'http://example.com',
      onError(src, err) {
        console.error(`Error when resolving ${src}: ${err}`)
      },
      processOptions: {
        headers: {
          Authorization: 'Basic Zm9vOmJhcgo=',
        },
      },
    }),
  ],
}

License

MIT