docs
docs copied to clipboard
Instructions for usage with Webpack
Migrating in from https://github.com/select2/select2/issues/5372
Select2 doesn't work out of the box with Webpack and additional steps are needed. The linked ticket has some suggestions.
This ticket should come up with the minimum steps needed to make Select2 compatible and then document them.
It was extreme pain to pack latest Select2(4.0.10) with transtions throught Webpack because of minimal information on the internet and in the documentation.
This example code should work for users that use Symfony Webpack Encore:
const $ = require('jquery');
require('select2');
const Slovak = require('select2/src/js/select2/i18n/sk');
$.fn.select2.defaults.set('debug', true); // This will help you debug problem with translations
$.fn.select2.defaults.set('language', Slovak);
$('form').select2()