Skip to content

feat: validate chunk-related options for the plugin#1890

Open
n0th1ng-else wants to merge 2 commits into
jantimon:mainfrom
n0th1ng-else:validate-input-params
Open

feat: validate chunk-related options for the plugin#1890
n0th1ng-else wants to merge 2 commits into
jantimon:mainfrom
n0th1ng-else:validate-input-params

Conversation

@n0th1ng-else
Copy link
Copy Markdown

@n0th1ng-else n0th1ng-else commented May 8, 2026

The plugin accepts excludeChunks and chunks options that tell which JS modules to inject into the HTML. In fact, it accepts arbitrary strings as the values.
This makes it confusing while refactoring the bundler configuration, as old and non-existing chunk names may be specified, and I have to understand if it's something with the build, or the plugins configuration was not adjusted during the past update.

I am suggesting adding the plugin options validation, so the plugin will throw an error if the mentioned chunk does not exist in the build

Examples:

  • Webpack
image
  • RSpack
image

THe plugin accepts `excludeChunks` and `chunks` options that tell which JS modules to inject into the html. In fact it accepts arbitrary strings
as the values.
This makes it confusing while refactoring the bundler configuration, as old and non-existing chunk names may be specified and I have to understand,
if it something with the build, or the plugins configuration was not adjusted during the past updated.

I am suggesting to add the plugin options validation, so the plugin will
throw an error if the mentioned chunk do not exist in the build
Copy link
Copy Markdown
Collaborator

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good improvement, but I am afraid it will be a breaking change, because other can have the same, I think logging warning is a better solution with TODO throw error in the next major release

@n0th1ng-else
Copy link
Copy Markdown
Author

@alexander-akait super, appreciate your time and the suggestion.

Yes I can definitely make it a warning in the scope of this PR 🌀

I will also prepare the follow-up PR to turn it into an error, so once you plan the major release, it will be ready 👍🏿

THe plugin accepts `excludeChunks` and `chunks` options that tell which JS modules to inject into the html. In fact it accepts arbitrary strings
as the values.
This makes it confusing while refactoring the bundler configuration, as old and non-existing chunk names may be specified and I have to understand,
if it something with the build, or the plugins configuration was not adjusted during the past updated.

I am suggesting to add the plugin options validation, so the plugin will
throw an error if the mentioned chunk do not exist in the build
@n0th1ng-else
Copy link
Copy Markdown
Author

@alexander-akait I have updated the PR. let me know if I can do something else 👍🏿

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.

2 participants