Giter Club home page Giter Club logo

Comments (14)

johanneswilm avatar johanneswilm commented on August 25, 2024 2

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.

johanneswilm avatar johanneswilm commented on August 25, 2024

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.

alpha-and-omega avatar alpha-and-omega commented on August 25, 2024

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.

johanneswilm avatar johanneswilm commented on August 25, 2024

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.

alpha-and-omega avatar alpha-and-omega commented on August 25, 2024

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.

johanneswilm avatar johanneswilm commented on August 25, 2024

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.

johanneswilm avatar johanneswilm commented on August 25, 2024

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.

alpha-and-omega avatar alpha-and-omega commented on August 25, 2024

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.

johanneswilm avatar johanneswilm commented on August 25, 2024

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.

alpha-and-omega avatar alpha-and-omega commented on August 25, 2024

Interesting, I'll take a look, I think I will sit with Vanilla-Datatables until that release.

from simple-datatables.

johanneswilm avatar johanneswilm commented on August 25, 2024

Until what release? 2.0.0? Ibrelease 1.7.x last night which is significantly smaller, but does hardlink moment.

from simple-datatables.

alpha-and-omega avatar alpha-and-omega commented on August 25, 2024

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.

johanneswilm avatar johanneswilm commented on August 25, 2024

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.

alpha-and-omega avatar alpha-and-omega commented on August 25, 2024

Okay okay, go your way, I am out.
Happy new year!

from simple-datatables.

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.