Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When extending default sources, tag is not optional #405

Closed
scottohara opened this issue Oct 14, 2021 · 1 comment · Fixed by #410
Closed

When extending default sources, tag is not optional #405

scottohara opened this issue Oct 14, 2021 · 1 comment · Fixed by #410

Comments

@scottohara
Copy link

(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 
@alexander-akait
Copy link
Member

Sorry for delay, PR welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants