Skip to content

[Bug]: Invalid URL error thrown when using html-loader #3353

@brinzl

Description

@brinzl

Version

System:
  OS: macOS 14.6.1
  CPU: (8) arm64 Apple M1
  Memory: 121.88 MB / 8.00 GB
  Shell: 5.9 - /bin/zsh
Browsers:
  Chrome: 128.0.6613.113
  Safari: 17.6
npmPackages:
  @rsbuild/core: 1.0.1-beta.15 => 1.0.1-beta.15

Details

Problem

When migrating a project from Webpack to RsBuild, I've encountered an "Invalid URL" error during the build/development process. This issue specifically occurs when using the html-loader in conjunction with rspack.htmlRspackPlugin or html-webpack-plugin. It seems the parsing of src attributes within HTML tags is triggering this error.

Expected Behavior

The build process should complete successfully without any errors, correctly processing the HTML files and resolving the asset paths.

Actual Behavior

An "Invalid URL" error is thrown during the build, indicating an issue with parsing the src attribute in HTML tags.

Reproduce link

https://github.com/BrinsilElias/rsbuild-html-loader

Reproduce Steps

Steps to Reproduce

  1. Set up a project using RsBuild with rspack.htmlRspackPlugin or html-webpack-plugin.
  2. Include html-loader in the configuration to process HTML files. Within an HTML file, use tags like <img> with src attributes pointing to assets.
  3. Run pnpm run build or pnpm run dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions