• Version 3.2.9
  • Published
  • 10.6 kB
  • 3 dependencies
  • MIT license


npm i @types/html-webpack-plugin
yarn add @types/html-webpack-plugin
pnpm add @types/html-webpack-plugin


TypeScript definitions for html-webpack-plugin



class HtmlWebpackPlugin

class HtmlWebpackPlugin extends Plugin {}


    constructor(options?: HtmlWebpackPlugin.Options);

      method apply

      apply: (compiler: Compiler) => void;

        method evaluateCompilationResult

        evaluateCompilationResult: (
        compilation: compilation.Compilation,
        content: string
        ) => Promise<string | TemplateFunction>;

          method executeTemplate

          executeTemplate: (
          templateFunction: TemplateFunction,
          chunks: any,
          assets: any,
          compilation: compilation.Compilation
          ) => Promise<string>;

            method postProcessHtml

            postProcessHtml: (html: string, assets: any, assetTags: any) => Promise<string>;


              interface Hooks

              interface Hooks extends compilation.CompilationHooks {}

                property htmlWebpackPluginAfterEmit

                htmlWebpackPluginAfterEmit: AsyncSeriesWaterfallHook<{
                html: string;
                outputName: string;
                plugin: HtmlWebpackPlugin;

                  property htmlWebpackPluginAfterHtmlProcessing

                  htmlWebpackPluginAfterHtmlProcessing: AsyncSeriesWaterfallHook<{
                  html: string;
                  assets: {
                  publicPath: string;
                  js: EntryObject[];
                  css: EntryObject[];
                  outputName: string;
                  plugin: HtmlWebpackPlugin;

                    property htmlWebpackPluginAlterAssetTags

                    htmlWebpackPluginAlterAssetTags: AsyncSeriesWaterfallHook<{
                    head: HtmlTagObject[];
                    body: HtmlTagObject[];
                    outputName: string;
                    plugin: HtmlWebpackPlugin;

                      property htmlWebpackPluginBeforeHtmlGeneration

                      htmlWebpackPluginBeforeHtmlGeneration: AsyncSeriesWaterfallHook<{
                      assets: {
                      publicPath: string;
                      js: EntryObject[];
                      css: EntryObject[];
                      outputName: string;
                      plugin: HtmlWebpackPlugin;

                        property htmlWebpackPluginBeforeHtmlProcessing

                        htmlWebpackPluginBeforeHtmlProcessing: AsyncSeriesWaterfallHook<{
                        html: string;
                        assets: {
                        publicPath: string;
                        js: EntryObject[];
                        css: EntryObject[];
                        outputName: string;
                        plugin: HtmlWebpackPlugin;

                          interface Options

                          interface Options {}

                            property cache

                            cache?: boolean | undefined;
                            • Emit the file only if it was changed. Default: true.

                            property chunks

                            chunks?: 'all' | string[] | undefined;
                            • Allows you to add only some chunks (e.g. only the unit-test chunk). Default: 'all'.

                            property chunksSortMode

                            | 'none'
                            | 'auto'
                            | 'dependency'
                            | 'manual'
                            | ((a: compilation.Chunk, b: compilation.Chunk) => number)
                            | undefined;
                            • Allows to control how chunks should be sorted before they are included to the html. Default: 'auto'.

                            property excludeChunks

                            excludeChunks?: string[] | undefined;
                            • Allows you to skip some chunks (e.g. don't add the unit-test chunk). Default: [].

                            property favicon

                            favicon?: false | string | undefined;
                            • Adds the given favicon path to the output html. Default: false.

                            property filename

                            filename?: string | undefined;
                            • The file to write the HTML to. You can specify a subdirectory here too (eg: assets/admin.html). Default: 'index.html'.

                            property hash

                            hash?: boolean | undefined;
                            • If true then append a unique webpack compilation hash to all included scripts and CSS files. This is useful for cache busting. Default: false.

                            property inject

                            inject?: 'body' | 'head' | boolean | undefined;
                            • Inject all assets into the given template or templateContent. When passing true or 'body' all javascript resources will be placed at the bottom of the body element. 'head' will place the scripts in the head element. Default: true.

                            property meta

                            meta?: false | { [name: string]: any } | undefined;
                            • Allows to inject meta-tags, e.g. meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}. Default: {}.

                            property minify

                            minify?: false | MinifyOptions | undefined;
                            • Pass a html-minifier options object to minify the output. https://github.com/kangax/html-minifier#options-quick-reference Default: false.

                            property showErrors

                            showErrors?: boolean | undefined;
                            • Errors details will be written into the HTML page. Default: true.

                            property template

                            template?: string | undefined;
                            • The webpack require path to the template.

                              See Also

                              • https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md

                            property templateContent

                            templateContent?: false | string | TemplateFunction | undefined;
                            • Allow to use a html string instead of reading from a file. Default: false, meaning the template option should be used instead.

                            property templateParameters

                            | false
                            | ((
                            compilation: compilation.Compilation,
                            assets: TemplateParametersAssets,
                            options: Options
                            ) => any)
                            | { [key: string]: any }
                            | undefined;
                            • Allows to overwrite the parameters used in the template.

                            property title

                            title?: string | undefined;
                            • The title to use for the generated HTML document. Default: 'Webpack App'.

                            property xhtml

                            xhtml?: boolean | undefined;
                            • If true render the link tags as self-closing (XHTML compliant). Default: false.

                            index signature

                            [option: string]: any;
                            • In addition to the options actually used by this plugin, you can use this hash to pass arbitrary data through to your template.

                            interface TemplateParametersAssets

                            interface TemplateParametersAssets {}

                              property chunks

                              chunks: {};
                              • Will contain all js & css files by chunk

                              property css

                              css: string[];
                              • Will contain all css files

                              property favicon

                              favicon?: string | undefined;
                              • Will contain a favicon if it exists

                              property js

                              js: string[];
                              • Will contain all js files

                              property manifest

                              manifest?: string | undefined;
                              • Will contain amn appcache manifest file if it exists

                              property publicPath

                              publicPath: string;
                              • The public path

                              Type Aliases

                              type Config

                              type Config = Options;
                              • Deprecated

                                use Options

                              type MinifyConfig

                              type MinifyConfig = MinifyOptions;
                              • Deprecated

                                use MinifyOptions

                              type MinifyOptions

                              type MinifyOptions = HtmlMinifierOptions;

                                Package Files (1)

                                Dependencies (3)

                                Dev Dependencies (0)

                                No dev dependencies.

                                Peer Dependencies (0)

                                No peer dependencies.


                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/html-webpack-plugin.

                                • Markdown
                                • HTML
                                  <a href="https://www.jsdocs.io/package/@types/html-webpack-plugin"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>