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

feat(kit): addBuildPlugin for builder-agnostic implementation #20587

Merged
merged 7 commits into from May 14, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

this adds a provider agnostic utility that can pass an object with keys (vite/webpack/rspack), each of which is a factory function for a plugin. This could be used to directly pass an unplugin, for example, and means that we can also 'upgrade' a module or integration if we + unplugin later support more builders (rspack being a case-in-point). All we would do is call the (new) factory function, if it exists.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Apr 29, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@danielroe danielroe added this to the v3.5 milestone May 2, 2023
@danielroe danielroe marked this pull request as ready for review May 11, 2023 22:29
if (pluginFactory.webpack) {
addWebpackPlugin(pluginFactory.webpack, options)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Just an idea: This function would also check if current builder is supported or not and make a warning a build plugin is added without vite/webpack support

Copy link
Member Author

Choose a reason for hiding this comment

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

I love the idea. Also maybe provide verbose warning and suggestion in module building mode?

Copy link
Member

Choose a reason for hiding this comment

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

For module building (i guess testing is only possible) we could do if partial in either case too :)

@danielroe danielroe merged commit 7006064 into main May 14, 2023
18 checks passed
@danielroe danielroe deleted the feat/add-build-plugin branch May 14, 2023 11:55
This was referenced May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants