Skip to content

[Bug]: HtmlRspackPlugin always generate the basics HTML tags even when using a template file #13087

@MangelMaxime

Description

@MangelMaxime

System Info

System:
OS: Linux 6.18 Arch Linux
CPU: (32) x64 Intel(R) Core(TM) i9-14900K
Memory: 19.71 GB / 62.50 GB
Container: Yes
Shell: 4.4.0 - /usr/bin/fish
Binaries:
Node: 22.16.0 - /run/user/1000/fnm_multishells/2281208_1771510672391/bin/node
Yarn: 1.22.22 - /run/user/1000/fnm_multishells/2281208_1771510672391/bin/yarn
npm: 11.10.0 - /run/user/1000/fnm_multishells/2281208_1771510672391/bin/npm
pnpm: 10.29.3 - /run/user/1000/fnm_multishells/2281208_1771510672391/bin/pnpm
Browsers:
Chromium: 145.0.7632.75
Firefox: 147.0.3
Firefox Developer Edition: 147.0.3

Details

Hello,

In our application we need to rspack to generate a cshtml containing only the <script> tags.

However, even with inject: false and a template file it always generate the basic structure of <html>.

new rspack.HtmlRspackPlugin({
        inject: false,
        template: "application.ejs",
      }),

application.ejs

hello

generates

<html>
<head></head><body>hello
</body></html>

instead of

hello

Reproduce link

https://github.com/MangelMaxime/rspack-repro-HtmlRspackPlugin-

Reproduce Steps

  1. pnpm install
  2. pnpm run build
  3. Check content of rsbuild-dist/application.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending triageThe issue/PR is currently untouched.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions