diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2019-01-29 12:35:53 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2019-01-29 14:48:39 +0300 |
commit | 40a04bc7e6a8d99e837938ff984e4bf4036dae3b (patch) | |
tree | a6d051a749314ccb9559b67dfaff9992fd0a4ae7 /app/assets/javascripts/issuable | |
parent | 2bb0d089ad70bf633071fc79dda0cc745a1c02a3 (diff) |
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')
-rw-r--r-- | app/assets/javascripts/issuable/auto_width_dropdown_select.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/issuable/auto_width_dropdown_select.js b/app/assets/javascripts/issuable/auto_width_dropdown_select.js index 612c524ca1c..e0fb58ef195 100644 --- a/app/assets/javascripts/issuable/auto_width_dropdown_select.js +++ b/app/assets/javascripts/issuable/auto_width_dropdown_select.js @@ -11,10 +11,14 @@ class AutoWidthDropdownSelect { init() { const { dropdownClass } = this; - this.$selectElement.select2({ - dropdownCssClass: dropdownClass, - ...AutoWidthDropdownSelect.selectOptions(this.dropdownClass), - }); + import(/* webpackChunkName: 'select2' */ 'select2/select2') + .then(() => { + this.$selectElement.select2({ + dropdownCssClass: dropdownClass, + ...AutoWidthDropdownSelect.selectOptions(this.dropdownClass), + }); + }) + .catch(() => {}); return this; } |