Enable Import Injection for Enhanced Compatibility with Modern Bundlers #709
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces a minor configuration tweak to Stencil setup by enabling
experimentalImportInjection
. This enhancement is primarily designed to address known integration issues with modern bundlers, including Vite, ensuring this component library's seamless performance across a wider range of projects.Reasoning:
Complementary PR: This change complements PR #486 "feat(build): add import injection to fix vite-based consumers" from ceifa. While ceifa's PR addressed similar concerns, this PR aims to further elaborate on the importance and relevance of the adjustment for broader compatibility.
Modern Bundlers Compatibility: By introducing this change, this component library now boasts improved compatibility with a range of modern bundlers, namely:
This ensures the components can be effortlessly integrated into projects regardless of their chosen bundling tool.
Evolving Recommendations in the React Community: The React core team and the broader community have been exploring alternatives to Create React App (CRA). A notable example is a recent PR that mentioned Vite among other alternatives. Additionally, there's a growing body of articles, such as this one, which discuss the limitations of CRA. While Vite is a significant focus of this PR, it's just one of the many evolving tools in the landscape.
Deprecation of Experimental Flag: The
experimentalImportInjection
flag will soon be deprecated in favor ofenableImportInjection
, as highlighted in Stencil's official documentation. The evolution of this feature from "experimental" to a more stable setting is further endorsed by a PR in the Stencil repository that originally introduced this functionality.Non-Breaking Enhancement: Importantly, this PR doesn't impose breaking changes. Instead, it augments compatibility with popular bundlers, ensuring components' versatility in diverse development environments.
By integrating this change, this component library remains adaptive, aligning with modern development trends and practices. I appreciate any feedback and hope we can incorporate this enhancement for the continued success and adaptability.