{"id":20926,"library":"antd-dayjs-vite-plugin","title":"antd-dayjs-vite-plugin","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"git@github.com:nekocode/antd-dayjs-vite-plugin","tags":["javascript","vite","vite-plugin","day.js","webpack","moment","antd","typescript"],"install":[{"cmd":"npm install antd-dayjs-vite-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add antd-dayjs-vite-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add antd-dayjs-vite-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin replaces moment with dayjs","package":"dayjs","optional":false},{"reason":"Peer dependency; the plugin is a Vite plugin","package":"vite","optional":false}],"imports":[{"note":"Named export only since v2.0.0.","wrong":"import antdDayjs from 'antd-dayjs-vite-plugin'","symbol":"antdDayjs","correct":"import { antdDayjs } from 'antd-dayjs-vite-plugin'"},{"note":"Default export in v1.x. In v2.x only named export exists.","wrong":"import { antdDayjs } from 'antd-dayjs-vite-plugin'","symbol":"antdDayjs (default)","correct":"import antdDayjs from 'antd-dayjs-vite-plugin'"},{"note":"Plugin type is from vite, not this package.","wrong":"import { Plugin } from 'antd-dayjs-vite-plugin'","symbol":"Plugin","correct":"import type { Plugin } from 'vite'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport { antdDayjs } from 'antd-dayjs-vite-plugin';\n\nexport default defineConfig({\n  plugins: [antdDayjs()],\n});","lang":"typescript","description":"Minimal usage: add the plugin to vite config to replace moment with dayjs in antd."},"warnings":[{"fix":"Change import from `import antdDayjs from '...'` to `import { antdDayjs } from '...'`.","message":"v2.0.0 changed from default export to named export","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Upgrade Vite to version 5 or later, or use v1.x with Vite 4.","message":"Requires Vite >=5; incompatible with Vite 4","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Manually replace `moment` imports with `dayjs` in your own code if needed.","message":"Plugin only affects antd components using moment. Custom moment usage remains unchanged","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure dayjs locale and plugin (e.g., utc, advancedFormat) are explicitly imported if used by antd components.","message":"Some edge cases with locale loading may break if dayjs plugins are not configured","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use named import: `import { antdDayjs } from 'antd-dayjs-vite-plugin'`.","cause":"Using default import with v2.0.0.","error":"Error: [vite] Internal server error: Default import is not available in antd-dayjs-vite-plugin"},{"fix":"Run `npm install antd-dayjs-vite-plugin` or check package.json.","cause":"Package not installed or incorrect path.","error":"Error: Cannot find module 'antd-dayjs-vite-plugin'"},{"fix":"Use `import { antdDayjs } from 'antd-dayjs-vite-plugin'`.","cause":"Importing as default in v1.x but v2.0.0 uses named export.","error":"TypeError: antdDayjs is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}