{"id":13526855,"url":"https://github.com/iamakulov/moment-locales-webpack-plugin","last_synced_at":"2025-05-15T12:04:01.639Z","repository":{"id":28257176,"uuid":"117819590","full_name":"iamakulov/moment-locales-webpack-plugin","owner":"iamakulov","description":"Easily remove unused Moment.js locales with webpack","archived":false,"fork":false,"pushed_at":"2023-01-04T21:57:28.000Z","size":1555,"stargazers_count":435,"open_issues_count":7,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-14T03:18:37.813Z","etag":null,"topics":["moment-js","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamakulov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-17T10:13:22.000Z","updated_at":"2024-11-29T03:57:14.000Z","dependencies_parsed_at":"2023-01-14T08:29:30.016Z","dependency_job_id":null,"html_url":"https://github.com/iamakulov/moment-locales-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamakulov%2Fmoment-locales-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamakulov%2Fmoment-locales-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamakulov%2Fmoment-locales-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamakulov%2Fmoment-locales-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamakulov","download_url":"https://codeload.github.com/iamakulov/moment-locales-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["moment-js","webpack","webpack-plugin"],"created_at":"2024-08-01T06:01:36.016Z","updated_at":"2025-05-15T12:03:56.628Z","avatar_url":"https://github.com/iamakulov.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# moment-locales-webpack-plugin\n\n[![npm](https://img.shields.io/npm/v/moment-locales-webpack-plugin.svg)](https://www.npmjs.com/package/moment-locales-webpack-plugin) [![Travis](https://img.shields.io/travis/iamakulov/moment-locales-webpack-plugin.svg)](https://travis-ci.org/iamakulov/moment-locales-webpack-plugin) [![Greenkeeper badge](https://badges.greenkeeper.io/iamakulov/moment-locales-webpack-plugin.svg)](https://greenkeeper.io/)\n\n\u003e Easily remove unused Moment.js locales when building with webpack\n\n## Why\n\n75% (160 minified KBs)¹ of [Moment.js’](https://github.com/moment/moment) size are files used for localization. [They are always included](https://iamakulov.com/notes/webpack-front-end-size-caching/#moment-js) when you build your app with webpack.\n\nYou don’t need most of these files if your app is only available in a few languages. Use this plugin to strip these KBs and optimize the app!\n\n\u003csmall\u003e¹ – tested with Moment.js 2.18.1\u003c/small\u003e\n\n## Install\n\n```sh\nnpm install --save-dev moment-locales-webpack-plugin\n```\n\n## Usage\n\n```js\n// webpack.config.js\nconst MomentLocalesPlugin = require('moment-locales-webpack-plugin');\n\nmodule.exports = {\n    plugins: [\n        // To strip all locales except “en”\n        new MomentLocalesPlugin(),\n\n        // Or: To strip all locales except “en”, “es-us” and “ru”\n        // (“en” is built into Moment and can’t be removed)\n        new MomentLocalesPlugin({\n            localesToKeep: ['es-us', 'ru'],\n        }),\n    ],\n};\n```\n\n## Plugin Options\n\n### **`localesToKeep: String[]`**\n\nAn array of locales to keep bundled (other locales would be removed).\n\nLocale names follow Moment.js behavior – if a specific locale name (e.g. `ru-ru`) is absent, but a more generic locale (`ru`) is available, the generic one will be kept bundled.\n\n### **`ignoreInvalidLocales: Boolean`**\n\nA flag to ignore invalid or unsupported locales in the `localesToKeep` array.\n\nBe careful! A typo in the `localesToKeep` array with this flag enabled will silently exclude the desired locale from your bundle.\n\n## Related projects\n\n-   [`moment-timezone-data-webpack-plugin`](https://github.com/gilmoreorless/moment-timezone-data-webpack-plugin) – a plugin optimizing the Moment Timezone library.\n\n## Contributing\n\nSee [CONTRIBUTING.md](https://github.com/iamakulov/moment-locales-webpack-plugin/blob/master/CONTRIBUTING.md) for how to contribute.\n\n## License\n\nMIT © \u003ca href=\"https://iamakulov.com\"\u003eIvan Akulov\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamakulov%2Fmoment-locales-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamakulov%2Fmoment-locales-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamakulov%2Fmoment-locales-webpack-plugin/lists"}