Tomselect with stimulus Js

Edit
equivalent
Public
stimulus
Rails

import { Controller } from "@hotwired/stimulus";
import TomSelect from "tom-select";

export default class extends Controller {
  connect() {
    this.select = new TomSelect(this.element, {
      plugins: ['dropdown_input'],
    });
  }

  clear() {
    this.select.clear();
    this.select.clearOptions();
  }

  reload() {
    this.select.sync();
  }
}


given you pin tom select to importmaps