Skip to content

[Feature]: export getHTMLPlugin #4513

@nia3y

Description

@nia3y

What problem does this feature solve?

i want to use html-rspack-plugin's hooks, such as used by RsbuildHtmlPlugin:

getHTMLPlugin()
        .getCompilationHooks(compilation)

but it's diffcult to get html-rspack-plugin, because this plugin is prebundled

hack method is:

api.modifyRspackConfig(async (config, { appendPlugins }) => {
  const HtmlPlugin = config.plugins?.find(
    (item) => item?.constructor.name === 'HtmlRspackPlugin'
  )?.constructor as typeof HtmlRspackPlugin;
  appendPlugins(new InterpolateHtmlPlugin(HtmlPlugin, replacements));
});

but it's not elegant

What does the proposed API look like?

in index.ts

export { getHTMLPlugin } from './pluginHelper';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions