orchidjs / tom-select

Tom Select is a lightweight (~16kb gzipped) hybrid of a textbox and select box. Forked from selectize.js to provide a framework agnostic autocomplete widget with native-feeling keyboard navigation. Useful for tagging, contact lists, etc.
https://tom-select.js.org
Apache License 2.0
1.63k stars 121 forks source link

[Bug]: dist CSS is not mapped in package.json #771

Open Jean85 opened 1 month ago

Jean85 commented 1 month ago

Bug description

I'm trying to use this package with the Symfony Asset Mapper, which leverages ESM loading to avoid Node/npm as a requirement. This seems to work well with your package, except for the fact that the CSS dist file is not mapped in the package.json, so ESM does not see that.

Expected behavior

CSS is included in the package, so that CDNs like jsDelivr will consider it and add to the needed files.

Steps to reproduce

  1. Go to jsDelivr
  2. Click on ESM mode button
  3. See that only the JS file is imported:
    <script type="module"> 
    import tomSelect from 'https://cdn.jsdelivr.net/npm/tom-select@2.3.1/+esm'
    </script>

Additional context

The Symfony docs refer to the package.json configuration file as a way to fix this; we probably need to add keys like sass or style to the root of the package.json, like Bootstrap does: https://github.com/twbs/bootstrap/blob/e3e00b5002139adb0d5dadd6002e15b7b6cd371f/package.json#L40