Comments (14)
Hey, well, the dependency on moment is not something I made up but something that was in Vanilla-DataTables when I took over. It's just that ES modules did not have dynamic module loading until now. I personally have no use for moment at all.
I am not proposing you do anything. You sound like a spoilt child and I spent the better part of last night to try to "fix" something that really you should be able to do in your own bundler. Besides that, 50k is not a lot in 2018.
I am not the ES committee nor do I earn any money on whether you use one package or the other. Be grateful for those people who try to help you even when you are so full of yourself that you make nonsensical claims about ES2015 and other things.
from simple-datatables.
Not really. ES2015+ projects can in most cases be compiled into ES5 type code. Browser support is not much worse than nodejs support - in fact module loading is somewhat better.
This has been situation for a couple of years now. Browserify/webpack with babel or buble are used to compile it into something else. If you are still writing pre-ES2015 type code on a larger project, you should probably look at upgrading in the near future.
In fact, as you will see in the rollup config file, the distributed version of this library is compiled to pre-ES2015 code using buble: https://buble.surge.sh/guide/
from simple-datatables.
Thank you for explanation. Minified ES5 shims are 25k but I can live with that.
I see you decided to include Moment too, is that neccessary ?
Any plans to include minified version which can be used immidiately without webpack ?
from simple-datatables.
Any plans to include minified version which can be used immidiately without webpack ?
You can see rollup makes it go through several steps [1], the last of which is uglify
- a minification process. Rollup removes that code that isn't used, so it should not add 25K or any other other amount of code not used. You can get this version directly out of npm.
As for moments - I did what was the simplest there to just include it like a normal dependency. It is probably possible to instead make it be a plugin so that one can decide whether or not to load it. You are welcome to send in a patch about that, if that is important to you.
I am also open to include other improvements. But in 2018, it makes no technical sense to go back to 2014 JS. There are no advantages and most modern software is written in ES2015+ code. Old browsers are not an issue.
[1] https://github.com/fiduswriter/Simple-DataTables/blob/master/rollup.config.js
from simple-datatables.
So it already minified, hmm, I see now:
sourcemap: 'inline'
this adds source map and makes index.js 500k size, almost equal to original DataTable project size ;)
from simple-datatables.
True. So yes, playing around with the settings, it should not be too hard to get it to get the filesize to be significantly smaller.
from simple-datatables.
Just removing the line gives an 80k file. I think having the source map is important for debugging mostly. We could set it up to create two versions: one with sourcemap and one without.
from simple-datatables.
Yes, and without Moment size is 25k = to Vanilla-Datatables size.
I think it is better to ship 4 versions: original, original without Moment, and 2 minified. Moment = 50k, 2 times of DataTables code and I personaly don't use it, since 'data-content' attribute solves all date sorting problems.
from simple-datatables.
I have published a version now that doesn't put the sourcemap inline.
I also created a new branch for a version with dynamic loading: https://github.com/fiduswriter/Simple-DataTables/tree/dynamic-loading
This basically means that moment is only loaded if the user actually tries to sort a column that is specified with a moment date format. However, this introduces a number of different new things which you probably don't want. It does work on pre-ES2015 browsers though, as you can see in the demo. This is likely going to be the future -- version 2.0.0 of the library.
from simple-datatables.
Interesting, I'll take a look, I think I will sit with Vanilla-Datatables until that release.
from simple-datatables.
Until what release? 2.0.0? Ibrelease 1.7.x last night which is significantly smaller, but does hardlink moment.
from simple-datatables.
Take a look at Vanilla-Datatables description:
A lightweight, extendable, dependency-free javascript HTML table plugin. Similar to jQuery DataTables, but without the dependencies.
I have replaced Jquery DataTables with Vanilla-Datatables because vanilla is 25k vs 500k of code, well, now you propose me to replace Vanilla with 106k of code just for ES2018 and new module management.
Now Simple-Datatables:
106k is not so lightweight
it has a dependency - module bundler
Maybe its just me and probably I am too picky, but I have my reasoning.
from simple-datatables.
Btw - it's 80k in the released version and 28k + 52k in the nreleased version. If you would be a bit more mature, you would work on the code that I worked on last night and check whether it works for you so that we can release it as the production version ASAP.
Most likely you'll need to read up on ES2015 first though.
from simple-datatables.
Okay okay, go your way, I am out.
Happy new year!
from simple-datatables.
Related Issues (20)
- Support for colgroup
- [BUG] init() method has no options parameter anymore? HOT 6
- events cannot be fired in the chrome environment HOT 2
- [BUG] A form field element should have an id or name attribute - HTML validity
- [BUG] Can't sort numeric columns
- [BUG] Columns.hide() and show() don't work with integer values
- Responsive Mobile HOT 8
- [BUG]`TypeError: Cannot read properties of undefined (reading 'settings')` at re insert table in version ^9.0.0 HOT 4
- [Feature Request] Ability to hide rows HOT 6
- [BUG] searchQuerySeparator not working via CDN HOT 2
- [BUG] columns property not properly generated HOT 2
- [BUG] Destroying and removing the table element is not working correctly HOT 1
- [BUG] data-order HOT 1
- [BUG] attribute data-sort not working in <th> HOT 2
- Sorting with empty cells doesn't work correctly.[BUG] HOT 2
- Input Listeners not working on subsequent pages [BUG] HOT 2
- [BUG] Latest release (9.0.4) is not open source and changes are not visible in GitHub HOT 2
- Support AJAX/Pagination+Search+Sort HOT 2
- How to know which cell is saved
- Support JSON-loading with selective headers 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 simple-datatables.