Skip to content

Document webpack change: DefinePlugin: add ability to use function return values #2314

@webpack-bot

Description

@webpack-bot

A pull request by @ronkorving was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#6793


What kind of change does this PR introduce?

This adds the following API to DefinePlugin:

new webpack.DefinePlugin({
  BUILT_AT: webpack.DefinePlugin.runtimeValue(Date.now, [fileDep, fileDep])
})

Did you add tests for your changes?

Yes

If relevant, link to documentation update:

Not yet

Summary

I wanted to inject an RPC schema into my builds, and when that schema changes, I want webpack-dev-server to rebuild and pick up the updated schema.

See #6749

Does this PR introduce a breaking change?

No

Other information

This PR is not ready to be merged (see comments inside), but I was hoping for some initial feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions