diff --git a/src/content/plugins/context-replacement-plugin.md b/src/content/plugins/context-replacement-plugin.md index a067322a9a23..fff08c617c25 100644 --- a/src/content/plugins/context-replacement-plugin.md +++ b/src/content/plugins/context-replacement-plugin.md @@ -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.