Skip to content

Context Replacement Plugin #2524

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

Merged
merged 7 commits into from
Dec 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/content/plugins/context-replacement-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ title: ContextReplacementPlugin
contributors:
- simon04
- byzyk
- masives
related:
- title: Issue 2783 - ContextReplacementPlugin Description
url: https://github.com/webpack/webpack/issues/2783#issuecomment-234137265
- title: Using context replacement module for date-fns
url: https://github.com/date-fns/date-fns/blob/master/docs/webpack.md
---

*Context* refers to a [require with an expression](/guides/dependency-management/#require-with-expression) such as `require('./locale/' + name + '.json')`. When encountering such an expression, webpack infers the directory (`'./locale/'`) and a regular expression (`/^.*\.json$/`). Since the `name` is not known at compile time, webpack includes every file as module in the bundle.
Expand Down