I'm trying to use select2 with webpack-encore on my symphony4 project. My app.js file is loaded without problem but not select2 while i installed it .. I do not understand why it's not working at all ...
My html
<select>
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
</select>
My app.js
require('../css/app.css');
const $ = require('jquery');
console.log('Hello Webpackfdsfds Encore! Edit me in assets/js/app.js');
require('select2')
$('select').select2({ width: '100%', placeholder: "Select an Option", allowClear: true })
What it looks likehttps://imgur.com/Wh1zMn8
I would be grateful if you would help me