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

add module argument to DefinePlugin.runtimeValue functions #8306

Merged
merged 5 commits into from Oct 31, 2018

Conversation

FranckFreiburger
Copy link
Contributor

@FranckFreiburger FranckFreiburger commented Oct 30, 2018

PR #6793 added the ability for DefinePlugin to use function that return values.
This PR just add the ability to these functions to access the module being parsed (see #8301).
eg.

  webpack.DefinePlugin.runtimeValue(module => module.resource ....)

issue #8301

What kind of change does this PR introduce?
It adds a module an argument to fct in DefinePlugin.runtimeValue(fct)

Did you add tests for your changes?
yes

Does this PR introduce a breaking change?
no

What needs to be documented once your changes are merged?
About the additional module argument

PR webpack#6793 added the ability for DefinePlugin to use function that return values.
This PR just add the ability to these functions to access the module being parsed (see webpack#8301).
eg.
```
  webpack.DefinePlugin.runtimeValue(module => module.resource ....)
```
@jsf-clabot
Copy link

jsf-clabot commented Oct 30, 2018

CLA assistant check
All committers have signed the CLA.

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This need to be documented (issue in webpack/webpack.js.org will be filed when merged)

@FranckFreiburger
Copy link
Contributor Author

current test is return·typeof·currentModule·===·'object', is is possible to test if currentModule is a webpack module ?

lib/DefinePlugin.js Outdated Show resolved Hide resolved
test/configCases/plugins/define-plugin/webpack.config.js Outdated Show resolved Hide resolved
sokra and others added 2 commits October 31, 2018 09:21
Co-Authored-By: FranckFreiburger <FranckFreiburger@users.noreply.github.com>
@webpack-bot
Copy link
Contributor

@FranckFreiburger Thanks for your update.

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

@sokra Please review the new changes.

@webpack-bot
Copy link
Contributor

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

@webpack-bot
Copy link
Contributor

Hi @FranckFreiburger.

Just a little hint from a friendly bot about the best practice when submitting pull requests:

Don't submit pull request from your own master branch. It's recommended to create a feature branch for the PR.

You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.

@sokra sokra merged commit c832cb7 into webpack:master Oct 31, 2018
@sokra
Copy link
Member

sokra commented Oct 31, 2018

Thanks

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

4 participants