Closed hwebb closed 3 years ago
Hi @hwebb ,
your package doesn't work anymore.
You mean that you had an application where the lib was working, then you upgraded to a newer version and it stopped working? if that is the case, can you tell me which versions?
I get nearly 100 errors like "node_modules\ngx-date-fns\fesm2015\ngx-date-fns.js depends on 'date-fns/parseISO'. CommonJS or AMD dependencies can cause optimization bailouts.".
Ok, those 100 errors you mention are actually warnings. Each warning comes with a link, If you click on it you'll find instructions about how to avoid them.
I'm wondering what is ngx-date-fns doing?
What do you mean?
I believe there is something wrong with the format of the date-fns package version 2.17.0. Try to install 2.16.1 and test again
npm install date-fns@2.16.1
This fixed all my issues...
Feel free to reopen if you still need help.
I guess the warnings @hwebb described are not related to his problem. ngx-date-fns working fine for me, I am on date-fns 2.16.1.
I tried installing it again with the version 2.19.0, and still have all those errors.
The errors are removed as soon as I comment out DateFnsModule.forRoot()
from the app module.
I import the it with import { DateFnsModule } from 'ngx-date-fns';
so I'm doing exactly as in your docs.
Other info is I'm on Windows.
The error is always like node_modules\ngx-date-fns\__ivy_ngcc__\fesm2015\ngx-date-fns.js depends on 'date-fns/formatDuration'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
The link is always pointing to the same website which just asks me to add all those dependencies to angular.json "allowedCommonJsDependencies", which is a couple of hundreds so I prefer avoiding it.
I would like using pure ES6 and not commun.js, this answer on stackoverflow says that some libraries have a special ES6 version that can be used instead https://stackoverflow.com/a/62589268/1063653
But I see that I'm the only one having this specific issue and I'm wondering if it's not an issue deeper into the code that is messing up with common.js.
Thanks
Hi @hwebb you need to install date-fns v2.16.1
or >= v2.21.1
I updated the installation instructions here: https://github.com/joanllenas/ngx-date-fns#installation
It's very confusing, I hope this helps.
I just updated date-fns to 2.21.1 and it worked indeed! I should have started with that.
I get nearly 100 errors like "node_modules\ngx-date-fns\fesm2015\ngx-date-fns.js depends on 'date-fns/parseISO'. CommonJS or AMD dependencies can cause optimization bailouts.". I thought it was coming from date-fns, but after a lot of headache I decided to remove your package, and by my surprise date-fns was working just fine without it!