Skip to content

When extending default sources, tag is not optional #405

Closed
@scottohara

Description

@scottohara

(I wasn't sure if this should be a bug report or a documentation issue. I guess it depends on whether the outcome ends up being a fix to the docs, or a fix to the code)

Bug report

According to the documentation for options.sources.list:

Using "..." syntax allows you to extend default supported tags and attributes

and...

If the tag name is not specified it will process all the tags.

Actual Behavior

When extending the default sources ("..."), omitting tag from any overrides does not work:

// This does not work
options: {
	sources: {
		list: [
			"...",
			{ attribute: "my-custom-src", type: "src" }
		]
	}
}
// ...but this does work
options: {
	sources: {
		list: [
			"...",
			{ tag: "img", attribute: "my-custom-src", type: "src" }
		]
	}
}

Expected Behavior

It should be possible to omit tag, as per the documentation.

There are no existing tests that cover this exact scenario.

How Do We Reproduce?

A full repro can be found here:
https://github.com/scottohara/webpack-html-loader-custom-source

  System:
    OS: macOS 11.6
    CPU: (8) arm64 Apple M1
    Memory: 138.19 MB / 16.00 GB
  Binaries:
    Node: 16.9.1 - ~/.asdf/installs/nodejs/16.9.1/bin/node
    npm: 7.23.0 - ~/.asdf/installs/nodejs/16.9.1/.npm/bin/npm
  Browsers:
    Chrome: 94.0.4606.81
    Chrome Canary: 97.0.4668.2
    Firefox: 84.0.1
    Safari: 15.0
  Packages:
    html-loader: 2.1.2 => 2.1.2 
    webpack: 5.58.2 => 5.58.2 
    webpack-cli: 4.9.0 => 4.9.0 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions