Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Instructions for usage with Webpack #41

Open
gricey432 opened this issue Aug 23, 2019 · 1 comment
Open

Instructions for usage with Webpack #41

gricey432 opened this issue Aug 23, 2019 · 1 comment

Comments

@gricey432
Copy link

Migrating in from select2/select2#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.

@BPavol
Copy link

BPavol commented Sep 5, 2019

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()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants