-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dayjs.extend() and dayjs.locale() result in an error when dayjs is imported from ESM bundle #1242
Comments
try import dayjs from 'dayjs/esm'; |
Then I get the following error:
And no, I don't want to change TS config. Also, as I have mentioned before, doing |
This is a conflict between our es export vs ts export and seems there no way to fix this until we make a breaking change release to make it export the same behavior. |
Do you plan to release v2 with these changes anytime soon? |
Well, at present no plan I am afraid. |
That's unfortunate. This bug makes ES bundle unusable. |
Seems a nice choice. We'll think about that. |
Now in 1.10.0 due to #313
For now i've added an alias in my webpack config if anyone is interested as a workaround: |
I'm using version 1.11.4 and it is very unreliable. Many times I get this type error when extending dayJs with relativeDate. The worst thing is that the error is not predictable, happens from time to time, and refreshing the page one or more times usually fixes it, which is very inconvenient. import dayjs from 'dayjs/esm';
import relativeDate from 'dayjs/esm/plugin/relativeTime'; Let's see if that fixes the issue. |
Any fix to this? |
@philipimperato v2 which is in alpha stage: #1281 |
import relativeTime from 'dayjs/esm/plugin/relativeTime'; dayjs.locale(zhCN); export default dayjs; |
Describe the bug
Extending with plugins and setting locale doesn't seem to work when using ESM bundle.
Following code produces following errors when used in Angular Typescript project.
The code above works fine when importing directly from
dayjs
instead ofdayjs/esm
.Information
The text was updated successfully, but these errors were encountered: