Registry / web-framework / build-plugin-moment-locales

build-plugin-moment-locales

JSON →
library0.1.3jsnpmunverified

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-locales
INSTALL
IMPORT
SIG · BUILD-PLUGIN-MOMEN
B
build-plugin-moment-locales
web-frameworkjavascriptv0.1.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin Configuration String
["build-plugin-moment-locales", { "locales": ["zh-cn", "en"] }]
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.

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.

{ "plugins": [ [ "build-plugin-moment-locales", { "locales": [ "zh-cn", "en-gb" ] } ], // other plugins... ], // other build.json configurations...
Debug
Known issues
deprecatedThis `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.
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.
affects: >=0.1.0
deprecatedThe 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.
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.
affects: >=0.1.0
gotchaFailing 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.
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.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Plugin 'build-plugin-moment-locales' not found or invalid configuration.
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.
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.
Large application bundle size, even with `build-plugin-moment-locales` configured.
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.
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.
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies
momentrequiredThis plugin optimizes Moment.js locales.
build-scriptsrequiredIt functions as a plugin for the `build-scripts` system in older ICE.js versions.
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
2
Resources
build-plugin-moment-locales — npm install build-plugin-moment-locales · libregistry