Error: MomentLocalesPlugin: Moment.js doesn’t include a locale you specified: de-ch.
See original GitHub issueHi
I use the nuxt moment module like this:
modules: [
'@nuxtjs/proxy',
'@nuxtjs/axios',
['@nuxtjs/moment', { locales: ['de-ch'], defaultLocale: 'de-ch' }],
...
Which seems to work, but as soon as I change something to the nuxt.config.js I get the following error:
Error: MomentLocalesPlugin: Moment.js doesn’t include a locale you specified: de-ch. Check the plugin’s
localesToKeep
option. You can see the full list of locales that Moment.js includes in node_modules/moment/locale/
I think the locales array is actually the localesToKeep
, am I right?
So it is actually not missing…
I also checked the locale itself. Normally I would expect it to be de-CH
but moment has a file de-ch
in which it is also called directly de-ch
– all lowercase.
Changing the locale to ‘de’ does not resolve the issue either.
What am I missing? Thanks for your help.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:15 (5 by maintainers)
Top Results From Across the Web
MomentLocalesPlugin: Moment.js doesn't include a locale you ...
Error : MomentLocalesPlugin: Moment.js doesn't include a locale you specified: ua. Check the plugins localesToKeep option #8012.
Read more >How to prevent moment.js from loading locales with webpack?
I'm looking at the source and it seems that if hasModule is defined, which it is for webpack, then it always tries to...
Read more >moment-locales-webpack-plugin - npm
Start using moment-locales-webpack-plugin in your project by running ... Easily remove unused Moment.js locales when building with webpack ...
Read more >Beginning JavaScript I18n with i18next and Moment.js | Phrase
A simple singleton with a supported property and a couple of helpful methods for checking support and locale output can get us started....
Read more >Moment.js documentation - DevDocs
You must make a new compelling argument for locale changes with significant, non-anecdotal evidence to support your position. If the string or format...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well if this is a blocking issue for you (I mean, being forced to stop and start manually again and again IS some sort of blocking issue to me 😄), there is a temporary workaround:
Just create your own module:
And inject it in your nuxt.config.js modules property BEFORE you inject @nuxtjs/moment:
This simple module is in charge of resetting your moment instance to the “en” locale (which is built into moment by default). I guess you have your own plugin to initiate moment to your desired locale (in your case “de-ch”).
If you have a better workaround, this would be interesting 😉
Thx
Any update on this ?