Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Not working "templateParameters" when prerender-loader used #50

Description

@vladlavrik

Hi!
Properties from "templateParameters" do not appear in html when using "prerender-loader".

Minimal code to reproduce:

webpack.config.js

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    mode: 'development',
    context: __dirname,
    entry: {
        bundle: './index.js',
    },
    output: {
        path: path.resolve(__dirname, 'build'),
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: `index_.html`,
            template: `!!prerender-loader?string!./index.html`,
            templateParameters: {
                injected: 'foo', // <--------
            },
        }),
    ],
};

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta property="x-injected" content="<%= injected %>">
</head>
<body></body>
</html>

html output

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <meta property="x-injected" content="<%= injected %>">
     <!--                                    ^^^^^^^  -->
</head>
<body>

<div>PRERENDERED CONTENT</div><script src="bundle.js"></script></body></html>```


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions