diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2019-01-29 10:35:53 +0100 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2019-01-29 12:48:39 +0100 |
commit | 40a04bc7e6a8d99e837938ff984e4bf4036dae3b (patch) | |
tree | a6d051a749314ccb9559b67dfaff9992fd0a4ae7 /app/assets/javascripts/project_select_combo_button.js | |
parent | 2bb0d089ad70bf633071fc79dda0cc745a1c02a3 (diff) | |
download | gitlab-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/project_select_combo_button.js')
-rw-r--r-- | app/assets/javascripts/project_select_combo_button.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/project_select_combo_button.js b/app/assets/javascripts/project_select_combo_button.js index 3dbac3ff942..d3b5f532dc1 100644 --- a/app/assets/javascripts/project_select_combo_button.js +++ b/app/assets/javascripts/project_select_combo_button.js @@ -44,9 +44,13 @@ export default class ProjectSelectComboButton { // eslint-disable-next-line class-methods-use-this openDropdown(event) { - $(event.currentTarget) - .siblings('.project-item-select') - .select2('open'); + import(/* webpackChunkName: 'select2' */ 'select2/select2') + .then(() => { + $(event.currentTarget) + .siblings('.project-item-select') + .select2('open'); + }) + .catch(() => {}); } selectProject() { |