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.
npm install build-plugin-moment-localesVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.
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.
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.
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.