ant-design / antd-dayjs-webpack-plugin

⏰ Day.js webpack plugin for Ant Design
https://ant.design/docs/react/use-with-create-react-app-cn#%E4%BD%BF%E7%94%A8-Day.js-%E6%9B%BF%E6%8D%A2-momentjs-%E4%BC%98%E5%8C%96%E6%89%93%E5%8C%85%E5%A4%A7%E5%B0%8F
290 stars 30 forks source link

使用了套件之後 a-date-picker 會壞掉 #57

Open gctcxu opened 3 years ago

gctcxu commented 3 years ago
  1. 已經在vue.config.js做設定

    • image
  2. 在date-picker顯示會有問題, 全部都是同一天

    • image
iamkun commented 3 years ago

please you are using the correct preset for antd4 or antd 3

gctcxu commented 3 years ago

please you are using the correct preset for antd4 or antd 3

I try to add preset 'antd' to argument to this plugin, but got ame result

image

iamkun commented 3 years ago

please make sure you are using antd4 if you are using this config

gctcxu commented 3 years ago

please make sure you are using antd4 if you are using this config

Hey, this is my package.json.lock configuration. It is v4 version image

relat plugin setting: antd v4, ant-vue 2 image

iamkun commented 3 years ago

you can try to use it with no config, just

plugins: [
    new AntdDayjsWebpackPlugin()
  ]
gctcxu commented 3 years ago

you can try to use it with no config, just

plugins: [
    new AntdDayjsWebpackPlugin()
  ]

This is the first my setting, please refer to first comment

iamkun commented 3 years ago

well a reproduction demo, please

KrishnaPG commented 3 years ago

Same problem. Getting below error:

moment.js:6 Uncaught TypeError: moment__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function
    at Object.getNow (moment.js:6)
    at postState (PickerPanel.js:123)
    at useControlledState (useMergedState.js:28)
    at PickerPanel (PickerPanel.js:119)
    at renderWithHooks (react-dom.development.js:15015)
    at mountIndeterminateComponent (react-dom.development.js:17841)
    at beginWork (react-dom.development.js:19079)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3942)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3991)
    at invokeGuardedCallback (react-dom.development.js:4053)
    at beginWork$1 (react-dom.development.js:23994)
    at performUnitOfWork (react-dom.development.js:22806)
    at workLoopSync (react-dom.development.js:22737)
    at renderRootSync (react-dom.development.js:22700)
    at performSyncWorkOnRoot (react-dom.development.js:22323)
    at react-dom.development.js:11357
    at unstable_runWithPriority (react.development.js:2764)
    at runWithPriority$1 (react-dom.development.js:11306)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11352)
    at flushSyncCallbackQueue (react-dom.development.js:11339)
    at discreteUpdates$1 (react-dom.development.js:22450)
    at discreteUpdates (react-dom.development.js:3753)
    at dispatchDiscreteEvent (react-dom.development.js:5919)

For some reason, the rc-picker/es/generate/moment.js is being invoked (instead of the dayjs version and getting this error.

fancymo commented 2 years ago

How to fix it

congxiaoyang commented 2 years ago

you can try to use it with no config, just

plugins: [
    new AntdDayjsWebpackPlugin()
  ]

This is the first my setting, please refer to first comment

Is this problem solved please?