rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Bug]: html template does not work as expected

Open zackarychapple opened this issue 1 year ago โ€ข 0 comments

System Info

zchapple@macos % npx envinfo --system --npmPackages '@rspack/*' --binaries --browser

  System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 187.50 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 6.14.13 - ~/.nvm/versions/node/v20.12.2/bin/npm
  npmPackages:
    @rspack/cli: ^0.6.3-canary-9bd4169-20240506141944 => 0.6.3 
    @rspack/core: ^0.6.3-canary-9bd4169-20240506141944 => 0.6.3 

Details

Using the bundled Rspack html plugin with a custom template script tags cannot be injected.

Rspack config

      new rspack.HtmlRspackPlugin({
        inject: false,
        chunks: ['main', 'vendor'],
        template: 'web-config/rspack.green.template.html',
      }),

Html template

<%= htmlWebpackPlugin.tags.headTags %>

Error Message

  ERROR in ร— HTML parsing error: Invalid first character of tag name
      โ•ญโ”€[90:1]
   90 โ”‚ 
   91 โ”‚ <!--These are the script tags directly from the webpack build-->
   92 โ”‚ <%= htmlWebpackPlugin.tags.headTags %>
      ยท  โ”€
   93 โ”‚ <!--End of script tags directly from webpack build-->
   94 โ”‚ 
      โ•ฐโ”€โ”€โ”€โ”€

Reproduce link

No response

Reproduce Steps

create a html template and try to use it.

zackarychapple avatar May 06 '24 19:05 zackarychapple