From db4f151be5546e3b3319e248e3d71a8c0ad03558 Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Mon, 16 Sep 2024 16:25:36 +0000 Subject: [PATCH] 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 --- rspack.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rspack.config.js b/rspack.config.js index 54eefc216f..6a8e40c4f6 100644 --- a/rspack.config.js +++ b/rspack.config.js @@ -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", + }, }; -- 2.39.5