From 40c623b202413676cb50d6767700e4a39e70b9fc Mon Sep 17 00:00:00 2001 From: Sli Date: Sun, 13 Oct 2024 03:00:20 +0200 Subject: [PATCH] Optimize select2 import --- core/static/webpack/jquery-index.js | 3 +++ core/static/webpack/utils/select2.ts | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/static/webpack/jquery-index.js b/core/static/webpack/jquery-index.js index 569d26e8..7c5159fe 100644 --- a/core/static/webpack/jquery-index.js +++ b/core/static/webpack/jquery-index.js @@ -13,6 +13,9 @@ require("jquery-ui/ui/widgets/tabs.js"); require("jquery-ui/themes/base/all.css"); +// We ship select2 here, otherwise it will duplicate jquery everywhere we load it +import "select2"; + /** * Simple wrapper to solve shorten not being able on legacy pages * @param {string} selector to be passed to jQuery diff --git a/core/static/webpack/utils/select2.ts b/core/static/webpack/utils/select2.ts index a18e82bb..44058ac3 100644 --- a/core/static/webpack/utils/select2.ts +++ b/core/static/webpack/utils/select2.ts @@ -142,7 +142,6 @@ * */ -import "select2"; import type { AjaxOptions, DataFormat,