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

Readable JS assets Plugin: Fix webpack 5 support #33785

Merged

Conversation

walbo
Copy link
Member

@walbo walbo commented Jul 30, 2021

Description

In webpack v5 Compilation.chunks and Chunk.files changed from arrays to sets. See https://webpack.js.org/blog/2020-10-10-webpack-5-release/#arrays-to-sets

Support both v4 and v5 by making sure we work with arrays (converting the set to array for v5) when generating the files list.

How has this been tested?

Tested the plugin both in webpack v4 and v5.

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

In webpack v5 `Compilation.chunks` and `Chunk.files` changed from arrays to sets. See https://webpack.js.org/blog/2020-10-10-webpack-5-release/#arrays-to-sets

Support both v4 and v5 by making sure we work with arrays (converting the set to array for v5) when generating the files list.
@gziolo gziolo added [Type] Build Tooling Issues or PRs related to build tooling [Tool] Readable JS Assets Webpack Plugin /packages/readable-js-assets-webpack-plugin [Type] Bug An existing feature does not function as intended labels Aug 2, 2021
Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

Looks good 👍 As a personal style preference, I think calling Array.from( setOrArray ) would be a bit nicer.

@walbo
Copy link
Member Author

walbo commented Aug 2, 2021

Looks good 👍 As a personal style preference, I think calling Array.from( setOrArray ) would be a bit nicer.

Yes. Personal preference. Seem like Array.from are the preferred method when looking at the codebase. I'll update the PR.

@jsnajdr jsnajdr mentioned this pull request Aug 2, 2021
10 tasks
@jsnajdr jsnajdr merged commit e5f24e2 into WordPress:trunk Aug 2, 2021
@github-actions github-actions bot added this to the Gutenberg 11.3 milestone Aug 2, 2021
@walbo walbo deleted the fix/readable-js-assets-webpack-plugin-webpack-5 branch August 2, 2021 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] Readable JS Assets Webpack Plugin /packages/readable-js-assets-webpack-plugin [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants