Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: MomentLocalesPlugin: Moment.js doesn’t include a locale you specified #23

Closed
ricardogobbosouza opened this issue Oct 24, 2019 · 5 comments · Fixed by #24
Closed

Comments

@ricardogobbosouza
Copy link

We use this plugin on moment-module to Nuxt.js

Problem:
nuxt-community/moment-module#25

This is because of this line
https://github.com/iamakulov/moment-locales-webpack-plugin/blob/master/index.js#L64

Can we have an option not to check the current locale?

@iamakulov
Copy link
Owner

iamakulov commented Nov 17, 2019

Hey @ricardogobbosouza! Sorry, missed your issue – my inbox’s a mess right now 😬

I’ve drafted #24 as a potential solution to the issue. Here’s the test that (I assume) covers your use-case:

// This handles https://github.com/iamakulov/moment-locales-webpack-plugin/issues/23
test('does not throw when someone changes the global locale before the build', async () => {
const moment = require('moment');
moment.locale('de-ch');
expect(() => {
new MomentLocalesPlugin({
localesToKeep: ['de-ch'],
});
}).not.toThrow();
expect(moment.locale()).toBe('de-ch');
});

Could you confirm whether it solves the issue you’re having? If you want to test it locally, this patch is available in npm under moment-locales-webpack-plugin@1.1.1-0.

I’ll be happy to publish 1.1.2 as soon as you confirm this works for you.

@ricardogobbosouza
Copy link
Author

@iamakulov thanks
I will test

@ricardogobbosouza
Copy link
Author

ricardogobbosouza commented Nov 18, 2019

@iamakulov its works 😄

@iamakulov
Copy link
Owner

Just released a @1.1.2 with the fix!

@ricardogobbosouza
Copy link
Author

thanks @iamakulov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants