{"id":12927,"library":"build-plugin-moment-locales","title":"Moment Locales Build Plugin for ICE","description":"This package is a build plugin specifically designed for the Alibaba ICE framework, targeting `ice.js` versions 1.x and 2.x. Its core purpose is to optimize application bundle sizes by providing a mechanism to selectively include only the necessary Moment.js locale files, which significantly reduces the overhead of Moment.js's extensive localization data that is otherwise bundled entirely by default. The last known version of this specific plugin is `0.1.3`, and it is considered superseded. For `ice.js` 3.x and newer, its functionality is provided by `@ice/plugin-moment-locales`. The Moment.js library itself is also in maintenance mode, encouraging migration to modern date-time alternatives like Day.js or Luxon. This plugin was part of the `build-scripts` configuration system used in earlier `ice.js` iterations.","status":"deprecated","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/alibaba/ice/tree/master/packages/plugin-moment-locales","tags":["javascript","build-scripts","build-plugin"],"install":[{"cmd":"npm install build-plugin-moment-locales","lang":"bash","label":"npm"},{"cmd":"yarn add build-plugin-moment-locales","lang":"bash","label":"yarn"},{"cmd":"pnpm add build-plugin-moment-locales","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This plugin optimizes Moment.js locales.","package":"moment","optional":false},{"reason":"It functions as a plugin for the `build-scripts` system in older ICE.js versions.","package":"build-scripts","optional":false}],"imports":[{"note":"This plugin is configured within an `ice.js` `build.json` file as a string, not directly imported into JavaScript/TypeScript application code. It's specific to `ice.js` 1.x/2.x.","symbol":"Plugin Configuration String","correct":"[\"build-plugin-moment-locales\", { \"locales\": [\"zh-cn\", \"en\"] }]"}],"quickstart":{"code":"{ \"plugins\": [ [ \"build-plugin-moment-locales\", { \"locales\": [ \"zh-cn\", \"en-gb\" ] } ], // other plugins... ], // other build.json configurations...","lang":"json","description":"Demonstrates how to configure `build-plugin-moment-locales` in an `ice.js` 1.x/2.x `build.json` file to include specific Moment.js locales for bundle optimization."},"warnings":[{"fix":"If using `ice.js` 3.x or later, remove `build-plugin-moment-locales` and install `@ice/plugin-moment-locales`. Update your `ice.config.ts` to use `momentLocales()` instead of the old `build.json` entry.","message":"This `build-plugin-moment-locales` package is deprecated. For `ice.js` 3.x and newer, migrate to `@ice/plugin-moment-locales` which provides similar functionality within the updated plugin system.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Consider re-evaluating the use of Moment.js in your project. If you must use Moment.js, ensure you are leveraging tree-shaking plugins effectively. For new development, explore alternatives to Moment.js.","message":"The underlying `moment.js` library itself is in maintenance mode and its creators recommend migrating to modern date-time libraries like Day.js or Luxon for new projects due to bundle size and mutable API concerns.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Always provide an array of desired locale strings (e.g., `['en-gb', 'zh-cn']`) to the `locales` option to ensure only necessary locales are bundled.","message":"Failing to specify the `locales` option (or providing an empty array) will result in no locale optimization, leading to a larger bundle size as all Moment.js locales will still be included.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"For `ice.js` 3.x, use `@ice/plugin-moment-locales` instead. For `ice.js` 1.x/2.x, ensure the plugin is correctly installed (`npm install build-plugin-moment-locales --save-dev`) and the `build.json` syntax is valid.","cause":"This error often occurs when trying to use an older `build-scripts` plugin with `ice.js` 3.x or a misconfigured `build.json` in older versions.","error":"Error: Plugin 'build-plugin-moment-locales' not found or invalid configuration."},{"fix":"Verify that the `locales` array in your `build.json` configuration for `build-plugin-moment-locales` contains the exact locale strings you intend to keep. Ensure `build-plugin-moment-locales` is listed in your `plugins` array.","cause":"The `locales` option might be incorrectly configured, empty, or the plugin is not being applied correctly in the build process, causing all Moment.js locales to be included.","error":"Large application bundle size, even with `build-plugin-moment-locales` configured."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}