Skip to content

Commit 1349ca6

Browse files
masivesmontogeek
authored andcommitted
docs(plugins): Add example on how to tree shake locales from date-fns (#2524)
Add example on how to tree shake locales from date-fns.
1 parent 5b3906e commit 1349ca6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/content/plugins/context-replacement-plugin.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ title: ContextReplacementPlugin
33
contributors:
44
- simon04
55
- byzyk
6+
- masives
67
related:
78
- title: Issue 2783 - ContextReplacementPlugin Description
89
url: https://github.com/webpack/webpack/issues/2783#issuecomment-234137265
10+
- title: Using context replacement module for date-fns
11+
url: https://github.com/date-fns/date-fns/blob/master/docs/webpack.md
912
---
1013

1114
_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.

0 commit comments

Comments
 (0)