Docs
Lite Usage
Use mmntjs/lite when bundle size matters and you want to add back only the pieces you need.
Guidance
Use Lite When You Want A Smaller Default Surface
mmntjs/lite is the size-first entry. It is useful when browser bundle cost matters and your application does not need the full default surface on every page by default.
The tradeoff is explicitness: features that feel implicit in the default entry should be treated as opt-in here, so the right question is not only whether lite works, but whether your current code assumes APIs that lite does not load automatically.
- Start with lite in new browser-facing entry points or tightly scoped modules.
- Do not switch large legacy surfaces blindly without checking which parsing, locale, and display helpers they use.
- Treat lite as a bundle-shaping choice, not as a drop-in synonym for the default entry.
Add Back Only What The Module Needs
The value of lite comes from keeping the base small and making extra capabilities visible in imports. That makes reviews easier because the code shows which features were added intentionally.
- Add
mmntjs/plugin/format-parsewhen you need custom format parsing or formatting helpers outside the base surface. - Add
mmntjs/locale/*modules only for the locales your browser bundle actually needs. - Keep timezone support separate instead of assuming named-zone data is part of lite or core by default.
Evaluate Lite With Real Bundle And Runtime Checks
A successful lite rollout usually proves two things at once: the application still behaves correctly, and the smaller entry actually improves the shipped bundle shape. One without the other is not a complete evaluation.
- Compare the actual bundler output, not just package file size.
- Run a few representative date flows in the browser, especially locale-sensitive and parsing-sensitive ones.
- If a module keeps growing extra add-ons, reconsider whether the default entry is the simpler choice there.
Examples
Small browser-oriented entry
import moment from "mmntjs/lite";
moment("2024-01-01").format("YYYY-MM-DD");Start here when you want the smaller entry without immediately adding extra capabilities.
Lite with explicit parsing and locale add-ons
import moment from "mmntjs/lite";
import "mmntjs/plugin/format-parse";
import "mmntjs/locale/ja";This keeps extra capabilities visible in imports instead of bundling them by default.
Module-by-module evaluation
// browser-heavy module under evaluation
import moment from "mmntjs/lite";
// elsewhere in the app you can still keep the default entry during rolloutLite does not need to be an all-or-nothing app-wide migration decision.
How To Use This Doc
Use this page as a migration review aid rather than as a generic tutorial. If the behavior in this area is business-critical, compare it directly against your current moment.js usage and record the outcome before expanding rollout.