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

Add support for other compatible bundlers, such as rspack #37

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

kgram
Copy link

@kgram kgram commented Oct 9, 2024

Adds support for rspack by optionally providing access to html-plugin hooks through options.

The new option, HtmlPlugin, defaults to the peer-dependency html-webpack-plugin, but will not fail until the plugin runs if absent. rspack.HtmlRspackPlugin can then be supplied instead.

All tests pass (NODE_OPTIONS=--openssl-legacy-provider was necessary for webpack 4, though), and a new end to end test suite has been added for rspack.

There are a few notable changes that was necessary to make this run:

  • excludeHtmlNames/includeHtmlNames now runs on outputName instead of plugin.options.filename, since rspacks html-plugin doesn't reliably provide raw plugin data in hooks. I believe this is the more correct option to use, but it may be a breaking change in some niche situations.
  • Extracting parent chunk name has been slightly modified to avoid hard-coded references to webpack.

Testing has been modified to fit this new option:

  • Pass the new HtmlPlugin option
  • Set compiler.outputFileSystem before running compiler
  • Handle non-string compilation errors
  • Async chunk fixture should use import() instead of require.ensure
  • Minor differences with rspack source map generation and output casing

Lock-file has been completely updated, since yarn seems to have changed their download URLs since it was last run.

@kgram kgram mentioned this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant