Skip to content
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

Using duration causes weird chunk file behaviour in angular #1770

Open
Moepkid opened this issue Jan 16, 2022 · 0 comments
Open

Using duration causes weird chunk file behaviour in angular #1770

Moepkid opened this issue Jan 16, 2022 · 0 comments

Comments

@Moepkid
Copy link

Moepkid commented Jan 16, 2022

Describe the bug
Importing and using the duration plugin causes the lazy loading to create two chunks with the same module names

Using the following code:

Import duration from "days/plugin/duration"
...
dayjs.extend(duration)

Will result in two chunk files with the same angular module name (news module):


Lazy Chunk Files      | Names                                    |  Raw Size | Estimated Transfer Size
152.js                | src-app-result-result-module             |  17.50 kB |                 5.93 kB
983.js                | src-app-news-news-module                 |  14.98 kB |                 5.40 kB
332.js                | src-app-schedule-schedule-module         |   9.09 kB |                 3.47 kB
108.js                | src-app-announcement-announcement-module |   7.34 kB |                 2.45 kB
949.js                | src-app-news-news-module                 |   7.28 kB |                 2.58 kB
297.js                | src-app-landing-landing-module           |   4.05 kB |                 1.39 kB

However, when removing this code it results in the following correct output:

common.js             | common                                   |  10.65 kB |                 4.24 kB
152.js                | src-app-result-result-module             |  10.41 kB |                 3.19 kB
108.js                | src-app-announcement-announcement-module |   7.34 kB |                 2.45 kB
949.js                | src-app-news-news-module                 |   7.28 kB |                 2.58 kB
297.js                | src-app-landing-landing-module           |   3.29 kB |                 1.16 kB
332.js                | src-app-schedule-schedule-module         |   2.01 kB |               800 bytes

Notice that we now have a "common" chunk.

As per the documentation, I am expected to use this duration extension to have it work. However, without this extension it works just fine. My knowledge of this library is limited to know exactly where the problem lies. I do think that it has something to do with the fact that "duration" isnt actually an extension and part of the base of DayJS.

Last note:

Great library btw! Im coming from moment and what a relieve that its so small and fast!

Expected behavior

Information

  • Angular 13
  • Day.js Version 1.10.7
  • OS: Windows
  • Browser Chrome & Firefox = latest
  • Time zone: GMT+1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant