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

EnvironmentPlugin: function for defaultValues #11919

Closed

Conversation

simon04
Copy link
Contributor

@simon04 simon04 commented Nov 4, 2020

EnvironmentPlugin: allow defaultValues to be computed from a function.

This is useful when the computation of the defaultValue is expensive, such as CI_COMMIT_TAG requiring an invocation of git rev-parse HEAD.

What kind of change does this PR introduce?

feature

Did you add tests for your changes?

not yet

Does this PR introduce a breaking change?

no

What needs to be documented once your changes are merged?

This is useful when the computation of the defaultValue is expensive,
such as `CI_COMMIT_TAG` requiring an invocation of `git rev-parse HEAD`.
@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

Copy link
Member

@sokra sokra left a comment

Choose a reason for hiding this comment

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

please add an test case and fill the PR template

@webpack-bot
Copy link
Contributor

@simon04 Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@sokra Please review the new changes.

@simon04 simon04 force-pushed the EnvironmentPlugin-default-function branch from f4deb86 to 25139f5 Compare November 4, 2020 16:44
@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@sokra
Copy link
Member

sokra commented Feb 18, 2021

This adds complexity that's often not needed. Please use DefinePlugin.runtimeValue for your usecase instead:

https://webpack.js.org/plugins/define-plugin/#runtime-values-via-runtimevalue

@sokra sokra closed this Feb 18, 2021
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

3 participants