Comments (9)
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.
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.
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.
If they do, I wonder why the compiler complains
from ngx-date-fns.
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.
That's good to know, thanks for taking the time to research this.
Cheers!
from ngx-date-fns.
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.
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.
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)
- Pipes isToday, isWeekend, isSameMonth HOT 4
- IsSameYear pipe HOT 3
- Support date-fns-tz HOT 8
- Add dfnsParseIso pipe HOT 2
- Allow empty value (Prevent throwing "Invalid time value") HOT 4
- Documentation for lazy loaded modules HOT 1
- Support `strictTemplates` / All pipes should accept null and undefined HOT 4
- ngx-date-fns.js depends on 'date-fns/parseISO'. CommonJS or AMD dependencies can cause optimization bailouts HOT 7
- FR: Add *Duration pipes HOT 2
- IsEqual Pipe HOT 2
- Documentation about tree shaking is not correct HOT 2
- FR: dfnsFormatRelativeToNow HOT 4
- is*() functions are missing HOT 5
- What is the amLocal equivalent of ngx-moment? HOT 2
- Angular 13 : "Encourage the library authors to publish an Ivy distribution" HOT 8
- Angular 14 support HOT 7
- Angular 16 support HOT 4
- date-fns 3.x support HOT 5
- Auto-detect language HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-date-fns.