-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: bootstrap5 ESM/ non-jQuery initialization crashes due to Responsive plugin #127
Comments
It appears to work okay here: https://stackblitz.com/edit/vitejs-vite-2e8adu?file=index.html%2Csrc%2Fstyle.css%2Csrc%2Fmain.ts&terminal=dev . Can you link to a test case showing the issue please? |
Facing same issue |
@imran-saleem834 can you update my test case to die the issue please? As you can see, it is running okay there. |
Please refer to the following StackBlitz project for an example of initializing DataTables in a Vue 3 and Bootstrap 5 environment without using jQuery: https://stackblitz.com/edit/datatables-net-vue3-bootstrap5-bkoavj. This code has been updated from a previous version, which can be found here: https://stackblitz.com/edit/datatables-net-vue3-bootstrap5. For a visual reference, see the screenshot from the DataTables/Responsive repository on GitHub. |
@AllanJard I tried to reproduce with my setup but failed: https://stackblitz.com/edit/vitejs-vite-vbqxc8?file=src%2Fmain-mjs.js. In this sample Some of this may be related to unusual usage of the
Note: Vite also uses esbuild |
@imran-saleem834 Thank you. I think there is a mix of versions there due to the Vue component which I've still to update for DataTables 2. That should be happening in the next few days all being well. @webketje I've noticed with one or two other support cases that deleting the package-lock.json file and node_modules, then doing a reinstall can fix this (obviously have a backup or source control in case the wheels come off!). I think there was an error in my earlier version dependencies. |
Ah that could explain the struggle to reproduce.. I will definitely revisit this issue in my local setup later. Can we leave this issue open for a bit longer so that other users hitting it easily find it and can add their findings/ continue on our previous investigation |
Absolutely. Let me know how you get on with a reinstall. |
When imported in an NPM package context as instructed in https://datatables.net/download/npm#ES-module-loader:
this line https://github.com/DataTables/Responsive/blob/3.0.0/js/responsive.bootstrap5.js#L5 fails due to error:
My guess is that this is because here:
https://github.com/DataTables/Responsive/blob/3.0.0/js/dataTables.responsive.js#L1719
Responsive
is only added to$.fn.DataTable
and$.fn.dataTable
, but not toDataTable
and that this may work in a global browser window context somehow, but fails when using an ESM bundler.I have not tested extensively but this issue may also be present for other integrations
The text was updated successfully, but these errors were encountered: