Bug: bootstrap5 ESM/ non-jQuery initialization crashes due to Responsive plugin
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- bootstrap, javascript, typescript
- Domain
- frontend
Research direction
Reproduce the NPM ESM setup shown in the issue, starting with responsive.bootstrap5.js around line 5. Then inspect dataTables.responsive.js around line 1719 and compare the exports used by the Bootstrap 5 integration. Done means the non-jQuery Bootstrap 5 ESM initialization no longer throws the reported Responsive error; check whether the same issue affects other integrations.
Written by the indexing model from the issue text.
Description
When imported in an NPM package context as instructed in https://datatables.net/download/npm#ES-module-loader:
import DataTable from 'datatables.net-bs5'
import 'datatables.net-responsive-bs5'
this line https://github.com/DataTables/Responsive/blob/3.0.0/js/responsive.bootstrap5.js#L5 fails due to error:
Uncaught TypeError: dataTables_bootstrap5_default.Responsive is undefined
mjs responsive.bootstrap5.mjs:13
__init app.js:38
js TransactionsTable.js:2
__init app.js:38
js index.js:1
__require app.js:41
<anonymous> app.js:42837
<anonymous> app.js:42838
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 to DataTable 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
- Dominant language
- TypeScript
- Stars
- 151
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataTables/Responsive
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
DataTables/Responsive#146 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
DataTables/Responsive#141 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
DataTables/Responsive#136 · 5 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
DataTables/Responsive#131 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataTables/Responsive#130 · 6 comments ·
All issues in DataTables/Responsive
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·