tom-select icon indicating copy to clipboard operation
tom-select copied to clipboard

Sass error since tom-select v2.2.0

Open morgoth opened this issue 2 years ago • 6 comments

When using the provided CSS, the error is thrown:

Error: "var(--ts-pr-min)" is not a number for `max'
        on line 26:18 of node_modules/tom-select/dist/css/tom-select.default.css, in function `max`
        from line 26:18 of node_modules/tom-select/dist/css/tom-select.default.css

There was a try to fix this in https://github.com/orchidjs/tom-select/pull/479 but it still does not work.

I'm using Ruby on Rails with sass processor (sassc-rails) and trying to @import dist/css/tom-select.default.css

morgoth avatar Oct 13 '22 06:10 morgoth

Fixes are described here: https://github.com/sass/sass/issues/2849

lafeber avatar Nov 08 '22 08:11 lafeber

Same problem for me on Ruby on Rails 7 Any workarounds or update coming? I'm doing this at production.rb for now.

- config.assets.css_compressor = :sass
+ config.assets.css_compressor = nil

ohsun0405 avatar Dec 05 '22 00:12 ohsun0405

@morgoth

Any chance you can lock your Tom Select version to 2.1.0 and import the SCSS files not the pre-processed versions and let me know if that works?

I'm starting to get the impression importing already processed CSS from the dist folder then running it back through the sassc-rails compiler is problematic, and not just for this lib.

MatthewKennedy avatar Dec 07 '22 13:12 MatthewKennedy

@MatthewKennedy Yes, it works on 2.1.0

My setup is:

# initializer file
Rails.application.config.assets.paths << Rails.root.join("node_modules/tom-select/dist/scss/")

and then in the scss file: @import "tom-select.default";

I tried upgrading this way to 2.2.2 and I no longer get sass error, but the javascript one this time: TypeError: tom_select__WEBPACK_IMPORTED_MODULE_1__.default is not a constructor

morgoth avatar Dec 07 '22 14:12 morgoth

Got the same error as above (for 2.2.2): TypeError: tom_select__WEBPACK_IMPORTED_MODULE_0__.default is not a constructor when tried to create stimulus controller for tomselect

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

export default class extends Controller {
  connect() {
    let config = { maxOptions: null }

    this.select = new TomSelect(el, config)
  }

  disconnect() {
    if (this.select) {
      this.select.destroy()
    }
  }
}

artur79 avatar Dec 15 '22 11:12 artur79

This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Feb 17 '24 01:02 github-actions[bot]

Same issue here: Uncaught TypeError: tom_select_1.default is not a constructor

Any idea what's the issue here?

fnagel avatar Apr 25 '24 13:04 fnagel