Skip to content

Excluding unused locales from webpack bundle #1797

Discussion options

You must be logged in to vote

@psimk 's posted a link to a repo of his in this thread with a working example that helped me get around the regex issue with webpack throwing errors from the .js.flow & .md files that were also getting included in the dynamic import of locales.

He opened a PR to make the change in the documentation.

new webpack.ContextReplacementPlugin(
  /date\-fns[\/\\]/,
  new RegExp(`[/\\\\\](${supportedLocales.join('|')})[/\\\\\]index\.js$`)
 )

Hopefully this helps anyone looking for a solution.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kossnocorp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants