summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/issuable_context.js
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-01-29 10:35:53 +0100
committerTim Zallmann <tzallmann@gitlab.com>2019-01-29 12:48:39 +0100
commit40a04bc7e6a8d99e837938ff984e4bf4036dae3b (patch)
treea6d051a749314ccb9559b67dfaff9992fd0a4ae7 /app/assets/javascripts/issuable_context.js
parent2bb0d089ad70bf633071fc79dda0cc745a1c02a3 (diff)
downloadgitlab-ce-40a04bc7e6a8d99e837938ff984e4bf4036dae3b.tar.gz
Wraps Select 2 Import into its own webpack bundle
Wraps all imports for select 2 to deferred imports, especially in the main.js we are actually checking if there is any select 2 element on the page or not.
Diffstat (limited to 'app/assets/javascripts/issuable_context.js')
-rw-r--r--app/assets/javascripts/issuable_context.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/issuable_context.js b/app/assets/javascripts/issuable_context.js
index f3d722409b0..48e7ed1318d 100644
--- a/app/assets/javascripts/issuable_context.js
+++ b/app/assets/javascripts/issuable_context.js
@@ -7,10 +7,14 @@ export default class IssuableContext {
constructor(currentUser) {
this.userSelect = new UsersSelect(currentUser);
- $('select.select2').select2({
- width: 'resolve',
- dropdownAutoWidth: true,
- });
+ import(/* webpackChunkName: 'select2' */ 'select2/select2')
+ .then(() => {
+ $('select.select2').select2({
+ width: 'resolve',
+ dropdownAutoWidth: true,
+ });
+ })
+ .catch(() => {});
$('.issuable-sidebar .inline-update').on('change', 'select', function onClickSelect() {
return $(this).submit();