Registry / devops / antd-dayjs-vite-plugin

antd-dayjs-vite-plugin

JSON →
library2.0.0jsnpmunverified

Vite plugin that replaces Moment.js with Day.js in Ant Design (antd) to reduce bundle size. Current stable version is 2.0.0, requires dayjs >=1 and vite >=5. It is the Vite counterpart of antd-dayjs-webpack-plugin, offering the same configuration options. Key differentiator: directly swaps moment locales and plugins with dayjs equivalents at build time, no manual code changes needed.

npm install antd-dayjs-vite-plugin
INSTALL
IMPORT
SIG · ANTD-DAYJS-VITE-PL
A
antd-dayjs-vite-plugin
devopsjavascriptv2.0.0
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

antdDayjs
import { antdDayjs } from 'antd-dayjs-vite-plugin'
import antdDayjs from 'antd-dayjs-vite-plugin'
Named export only since v2.0.0.
antdDayjs (default)
import antdDayjs from 'antd-dayjs-vite-plugin'
import { antdDayjs } from 'antd-dayjs-vite-plugin'
Default export in v1.x. In v2.x only named export exists.
Plugin
import type { Plugin } from 'vite'
import { Plugin } from 'antd-dayjs-vite-plugin'
Plugin type is from vite, not this package.

Minimal usage: add the plugin to vite config to replace moment with dayjs in antd.

import { defineConfig } from 'vite'; import { antdDayjs } from 'antd-dayjs-vite-plugin'; export default defineConfig({ plugins: [antdDayjs()], });
Debug
Known issues
breakingv2.0.0 changed from default export to named export
fix
Change import from `import antdDayjs from '...'` to `import { antdDayjs } from '...'`.
affects: <2.0.0
breakingRequires Vite >=5; incompatible with Vite 4
fix
Upgrade Vite to version 5 or later, or use v1.x with Vite 4.
affects: >=2.0.0
gotchaPlugin only affects antd components using moment. Custom moment usage remains unchanged
fix
Manually replace `moment` imports with `dayjs` in your own code if needed.
affects: all
gotchaSome edge cases with locale loading may break if dayjs plugins are not configured
fix
Ensure dayjs locale and plugin (e.g., utc, advancedFormat) are explicitly imported if used by antd components.
affects: all
Errors
Common errors & fixes
Error: [vite] Internal server error: Default import is not available in antd-dayjs-vite-plugin
Using default import with v2.0.0.
fix
Use named import: `import { antdDayjs } from 'antd-dayjs-vite-plugin'`.
Error: Cannot find module 'antd-dayjs-vite-plugin'
Package not installed or incorrect path.
fix
Run `npm install antd-dayjs-vite-plugin` or check package.json.
TypeError: antdDayjs is not a function
Importing as default in v1.x but v2.0.0 uses named export.
fix
Use `import { antdDayjs } from 'antd-dayjs-vite-plugin'`.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
dayjsrequiredPeer dependency; the plugin replaces moment with dayjs
viterequiredPeer dependency; the plugin is a Vite plugin
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
antd-dayjs-vite-plugin — npm install antd-dayjs-vite-plugin · libregistry