Bug 37824: (QA follow-up) Fix improper handling of jQuery and DataTables libraries by marking them as externals

This commit addresses an issue where jQuery and DataTables libraries (datatables.net and related extensions) were not functioning correctly when bundled with rspack. These libraries expect to be loaded in the global scope rather than as bundled modules, leading to initialization issues.

To resolve this, jQuery and all related DataTables libraries (datatables.net, datatables.net-buttons, datatables.net-buttons/js/buttons.html5, etc.) are marked as externals in the rspack configuration. This ensures they are treated as global dependencies, preventing conflicts and allowing proper initialization.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit db4f151be5)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Paul Derscheid 2024-09-16 16:25:36 +00:00 committed by Lucas Gass
parent ace4e71eb8
commit d0de116c8f
1 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,7 @@ module.exports = {
"koha-tmpl/intranet-tmpl/prog/js/vue/dist/"
),
chunkFilename: "[name].js",
globalObject: "window",
},
module: {
rules: [
@ -63,4 +64,12 @@ module.exports = {
__VUE_PROD_DEVTOOLS__: false,
}),
],
externals: {
jquery: "jQuery",
"datatables.net": "DataTable",
"datatables.net-buttons": "DataTable",
"datatables.net-buttons/js/buttons.html5": "DataTable",
"datatables.net-buttons/js/buttons.print": "DataTable",
"datatables.net-buttons/js/buttons.colVis": "DataTable",
},
};