Supporting ES6/ESM and TypeScript in v5.0 #776
Replies: 4 comments 4 replies
-
My view so far has been that SlickGrid is a library that will require some tweaking and customisation before use. Therefore, I've always avoided providing a final 'build' for it, insisting that the build was part of the developer's responsibility. Perhaps as the grid matures, providing different options as final builds would be a logical part of the package. I feel like if we do that, we should streamline what gets built somewhat, at least losing the examples and any other test code and nonessentials. Perhaps nonessentials should even be split into a separate repo or at least folder? Sounds like this would fit in well with your suggestions. The features this would bring sound great, especially being TS-ready. I'm just wondering if we're packing too much into a breaking release though - perhaps it would be clearer to keep v4 only to removal of jQuery, and do further structural changes in v5? It might not be good to hit consumers with too many changes all at once. On the other hand, they'll be rejigging all their dependencies with the jQuery removal, so perhaps it is the right moment to be rearranging dependencies in general? |
Beta Was this translation helpful? Give feedback.
-
I should also mention that, being in a remote area, I sometimes work on the lib out of wifi range, ie. offline. I note that moving to the CDN references in the examples means that they all stop working when I do this. |
Beta Was this translation helpful? Give feedback.
-
My gut feeling here is that a v5 release after a short time would be better. I think throwing too much change at consumers can potentially create confusion for them. Although it will in the end be the same level of change, having a separate release would make documentation and dealing with issues a lot clearer. |
Beta Was this translation helpful? Give feedback.
-
@6pac thought of providing an update on what I'm working on and got working so far on the next major... there's a lot 😉
So the future is looking bright, I'm working on steps 1 to 6 and 7 will come later. The next major promises to include a lot of nice things and be a lot more modern. I'll push what I have in a few days or a week, so you'll be able to try it yourself, it requires a few dev dependencies to be installed ( in summary, I'm done with testing POC stuff and everything that I wasn't sure if it was going to work or not, well it turns out that I got it all working and it's quite awesome, there's a lot of new concept coming and that will totally modernize SlickGrid... EDIT I'm actually having issues with what esbuild is bundling, it includes everything that is imported, so it's actually bundling the same functions multiple times. So I'm not sure yet how I will produce ES6 bundle yet. For example some core methods are used in SlickGrid and SlickDataView and when I use EDIT 2 EDIT 3 So the end result will be that the standalone Also another great thing coming up, I'm working on a new modern styling theme (similar to Ag-Grid) and all images are being dropped and going away, these will be replaced with SVG icons to go along with the new theme and it's beautiful and small :) |
Beta Was this translation helpful? Give feedback.
-
I'm currently looking at possibly supporting ES6, ESM & still support
<script>
(iife) by using ESBuild which is very fast to build and also build minified code. Supporting both would create 2 (or 3) different folders underdist/
dedicated for each format we want to support.For user who still prefer
<script>
loading (standalone asiife
), it would not be a big changes for them, the only change is to their script files location, it would have to change to something like/dist/browser/
. Apart from that, the usage would be exactly the same (new Slick.Grid()
, ....)The old
<script>
(browser) is still supported with ESBuild usingiife
type (iife
is what SlickGrid was built with for years), our new location would be under/dist/browser/
so users would have to adjust their script locationsES6/ESM
For users who want ES6/ESM, user could use
imports
. However with this approach, we would not have access to theSlick
object and it would not be on thewindow
object either. The advantage is better ES6 support but also smaller builds with better tree shaking and would close the old issue #41The new ES6/ESM would be under a new location
/dist/esm/
(ESM) or/dist/cjs/
(CommonJS)So the question is, do we want to ship this under v4.0 as well or wait for a v5.0? This would be a bigger breaking change for users but it would bring ES6 support which was requested in an old issue #41. The small build is a really tempting feature from my point of view and there's also code that I do not use in my libs, so ES6 imports would allow me to avoid downloading code that I do not use. Also lastly another benefit would be that ESBuild also support TypeScript out of the box, so it would be as simple as changing the
.js
extension to.ts
and the build would still work.A disadvantage with this new feature would be that we need to run a build before seeing the changes in any of the examples, so it would take a bit more time to see the result of a code change. I'm planning to create a SPA (single page app) and use ESBuild in watch mode so that we can make code changes without having to rebuild/reload all the time (however all standalone examples would have to change)
Beta Was this translation helpful? Give feedback.
All reactions