Git Product home page Git Product logo

Comments (9)

MickL avatar MickL commented on May 24, 2024 1

So i investigated a little bit into this and it seems like this is an issue of date-fns. Using 2.16.1 there is no warning and tree shaking works. Using >2.16.1 <= 2.19.0 there is a warning and FULL date-fns is imported.

So the warning is nice and correct and should not be ignored / suppressed by use of allowedCommonJsDependencies

Issue: date-fns/date-fns#2207

from ngx-date-fns.

joanllenas avatar joanllenas commented on May 24, 2024 1

Tree shaking is fixed from date-fns v2.21.1 onwards.
Just updated the README clarifying that.
Thanks for your help,
cheers!

from ngx-date-fns.

joanllenas avatar joanllenas commented on May 24, 2024

It shouldn't be normal, date-fns provides ESM builds since v2.0.0.
https://date-fns.org/v2.0.0/docs/ECMAScript-Modules

from ngx-date-fns.

MickL avatar MickL commented on May 24, 2024

If they do, I wonder why the compiler complains

from ngx-date-fns.

joanllenas avatar joanllenas commented on May 24, 2024

Ok, I've investigated a little bit more and it looks like imports need to have esm in their paths to get rid of those warnings. Like this: import addBusinessDays from 'date-fns/esm/addBusinessDays';
This is weird because the docs don't tell anything about it.

Anyway, I'm not sure if fixing esm will break ie11 applications, I will have to investigate a little more before releasing anything.

If you want to help try installing 8.0.1-beta.0 and let me know if you still see those warnings. If you have the chance to test on ie11 that would be great as well. I don't have a windows machine right now.

Cheers!

from ngx-date-fns.

joanllenas avatar joanllenas commented on May 24, 2024

That's good to know, thanks for taking the time to research this.
Cheers!

from ngx-date-fns.

jpduckwo avatar jpduckwo commented on May 24, 2024

date-fns/date-fns#2339
I think this will solve this issue in future builds once merged... maybe this should be left open until date-fns is resolved and it's confirmed working?

from ngx-date-fns.

joanllenas avatar joanllenas commented on May 24, 2024

Thanks for pointing that out @jpduckwo , I will keep an eye on that PR.
And you are right, let's keep this opened for visibility until this is fixed.

Cheers!

from ngx-date-fns.

joanllenas avatar joanllenas commented on May 24, 2024

FYI, a new version just came out that fixes the issue:
https://github.com/date-fns/date-fns/releases/tag/v2.20.3
I will give this a try during the weekend and if it works, will update the README explaining the proper lib. ranges and so on.

from ngx-date-fns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.