-
Notifications
You must be signed in to change notification settings - Fork 379
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(builder): source.globalVars support function usage #3501
feat(builder): source.globalVars support function usage #3501
Conversation
🦋 Changeset detectedLatest commit: 0a2f0a4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 212 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3501 +/- ##
==========================================
+ Coverage 57.59% 57.86% +0.26%
==========================================
Files 672 653 -19
Lines 17794 17179 -615
Branches 3876 3746 -130
==========================================
- Hits 10249 9940 -309
+ Misses 6934 6640 -294
+ Partials 611 599 -12
... and 132 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Co-authored-by: Asuka109 <asuka109@foxmail.com>
Summary
🤖 Generated by Copilot at 0e2a80f
This pull request enhances the
source.globalVars
option for the builder plugins and the document package, allowing it to be a function that can customize the global variables based on the environment and the build target. It also updates the imports, types, schemas, and documentation of the affected files, and adds test cases and changelogs for the new feature.Details
🤖 Generated by Copilot at 0e2a80f
setup
methods, and the logic of defining and serializing the global variables in thedefine.ts
files of the@modern-js/builder-rspack-provider
and@modern-js/builder-webpack-provider
packages, which are plugins for therspack
andwebpack
bundlers, respectively (link, link, link, link, link)globalVars
option in thesource.ts
files of the@modern-js/builder-shared
package, which is a common dependency for builder plugins (link, link, link, link, link)globalVars
option can be a function in thedefine.test.ts
files of the@modern-js/builder-rspack-provider
and@modern-js/builder-webpack-provider
packages (link, link)globalVars
option in both English and Chinese (link, link, link)define
option, and the precautions of using theglobalVars
option in both English and Chinese (link, link, link, link)getAutoInjectEnv
function, which is used to get the public environment variables (link)globalVars
property to thesource
config option in thecreateDefaultConfig
and thecreateLegacyDefaultConfig
functions, and assign it the value of thegetAutoInjectEnv
function with theappContext
parameter (link, link)getAutoInjectEnv
function, which is no longer needed (link)createBuilderGlobalVars
function, which is no longer needed, in theinitSourceConfig
function (link)createBuilderGlobalVars
function, which is no longer needed (link)Related Issue
Checklist
pnpm run change
.