Replies: 2 comments
-
It's not that easy, we have to support 3 target outputs (cjs, esm, iife) without breaking Controls/Plugins and keep them as standalone in the iife format and for that I created a custom esbuild plugin that removes all SlickGrid/scripts/esbuild-plugins.mjs Lines 1 to 15 in e215137 This in theory shouldn't matter much since that esbuild plugin is only meant to remove
Yes because just importing it won't add it to the Anyway, that was a long reply but if you find a way to deal with everything I wrote then I would be open for a contribution but at this point I found the easiest is to do it the way you've done. I will update the v4 and 5 migrations. Remember that if you do make a contribution, all 3 build targets must still work as intended without affecting build size. |
Beta Was this translation helpful? Give feedback.
-
I'm converting this into a Discussion since I don't think this will change but I don't necessarily want to close the issue, I just want to promote it to a Discussion |
Beta Was this translation helpful? Give feedback.
-
I recently upgraded from SlickGrid v2 to v5. I read the v4 migration guide and the v5 migration guide which note SortableJS as a dependency.
I use webpack v5 and babel and therefore the ESM style. To my surprise installing sortablejs using npm and importing was not sufficient.
This generates the following exception:
I'm surprised it didn't say "SlickGrid requires Sortable.js module to be loaded" as there seems to be code in initialize() to detect that.
You can avoid the error if you
set enableColumnReorder: false
, but I like that feature.The solution was to add
window.Sortable = Sortable
before calling the SlickGrid constructor. Then I created a solution using imports-loader.I imagine this could be solved by adding an import for sortablejs at the top of dist/esm/index.js or perhaps there's a better way of integrating SortableJS as an optional dependency. Perhaps at the least there should be a note in the v5 migration guide about this.
Beta Was this translation helpful? Give feedback.
All reactions