arendjr/selectivity

Selectivity not defined in non-minified vanilla builds.

Closed this issue · 6 comments

It appears Selectivity is not defined in non-minified vanilla builds.

#121 (comment)

Hi, did you have any chance of testing this? Is it actually a bug?
Thanks

I have just pushed a 3.0.3 version that should've fixed the issue. Can you confirm this? Thanks!

Honestly I can't say for sure. I am still getting an error.

This is the basic code I am using to test

  <div id="someid"></div>
  
  <script type="text/javascript">
  console.log(Selectivity);
      var selectivity = new Selectivity.Inputs.Single({
      allowClear: true,
      element: document.querySelector('#someid'),
      items: ['Amsterdam', 'Antwerp'],
      placeholder: 'No city selected'
  });
  </script>

By using selectivity.min.js that was packed with version 3.0.2 it worked, with the non-minified version of 3.0.2 it gave me the error Uncaught ReferenceError: Selectivity is not defined.
With 3.0.3 the link to /releases/download/3.0.3/selectivity-3.0.3.tar.gz is broken so I cannot test with the above setup.

Btw, my original setup is an Angular 2 app. By importing the minified v3.0.2 it works, by importing the non-minified v3.0.3 via require it gives me the error Selectivity.Inputs.Multiple is not a constructor.

I don't know if I'm doing something wrong, I hope you can give me a feedback, thanks.

Sorry, my bad... I have a tendency to forget some manual steps in the release process... maybe I should check if I can publish releases automatically using the GitHub API as well...

Anyway, the tarball is now attached, so the link should work now.

Regarding importing the NPM version using require(), please have a look at the README: https://github.com/arendjr/selectivity#which-module-do-i-require

Thanks! Everything works, both the non-minified version and the NPM version, now that I have required all the needed modules with require('selectivity/dropdown'); etc...

Thanks a lot for your support, imo this issue is resolved!

Glad I could help!