question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pick required language only.

See original GitHub issue

I was surprised that all the languages are inside my js bundle.

image

It would be great to have English by default and load additional language when Validator.useLang(...) triggered.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
hongyuan1306commented, Nov 8, 2017

A workaround for those in the same shoe: use webpack IgnorePlugin to include only the necessary language file. For example, to include English only, add the line to webpack configuration file:

new webpack.IgnorePlugin(/^\.\/(?!en)(.+)$/, /validatorjs\/src\/lang/),

3reactions
hongyuan1306commented, Nov 2, 2017

I run into the same problem, in that in the final bundle, about 7.6K gzipped is taken up by these unused language files:

selection_066

Does anyone have any clue how to exclude the files from being included? I am using webpack2 for packaging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pick a programming language - John Mosesman
You're just starting out. You want to learn how to program and become a developer, and you're trying to pick a language.
Read more >
Change your language on Google - Android
On your Android phone or tablet, go to the Search settings page. Choose your language settings. Language in Google products: This setting changes...
Read more >
Setting language preferences in a browser - W3C
Under the Languages heading, choose your preferred language(s) by selecting the language or language+region combination you want from the list ...
Read more >
Turn on automatic language detection - Microsoft Support
Open Edit > Language > select Language. Review the languages shown above the double line in the Mark selected text as list. Office...
Read more >
Documentation - Utility Types - TypeScript
Constructs a type consisting of all properties of Type set to required. ... Constructs a type by picking the set of properties Keys...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found