Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM/ES6 module support #1149

Closed
cdalexndr opened this issue Jul 14, 2021 · 7 comments
Closed

ESM/ES6 module support #1149

cdalexndr opened this issue Jul 14, 2021 · 7 comments
Labels
Feature Feature requests/suggestions
Milestone

Comments

@cdalexndr
Copy link

Please provide esm module distribution.

@leongersen
Copy link
Owner

Could you add some details on your use case?

@leongersen leongersen added the Feature Feature requests/suggestions label Jul 15, 2021
@ivoevolution
Copy link

we need to

import noUiSlider from 'noUiSlider'

//...

@leongersen
Copy link
Owner

@ivoevolution You can currently do that:

// Either import the default:
import noUiSlider from 'nouislider';
// Or the namespace:
import * as noUiSlider from 'nouislider';

@cdalexndr
Copy link
Author

cdalexndr commented Jul 22, 2021

@ivoevolution You can currently do that:

Without any javascript bundler, directly in browser:

<script type="module">
    import noUiSlider from 'nouislider.js'; //auto loads nouislider.js
</script>

For this to work, the distributed javascript must have esm compliant export statements.
Other libraries build a separate .esm.js & min file, with this specificaiton.

@leongersen
Copy link
Owner

Ah, right. I'm open to a PR adding these distribution files.

@leongersen leongersen added this to the 15.4.0 milestone Aug 12, 2021
leongersen added a commit that referenced this issue Aug 12, 2021
@leongersen
Copy link
Owner

As of noUiSlider 15.4.0 the distribution offers nouislider.mjs and nouislider.min.mjs. You can see the module import in action here. Thank you for contributing!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Feature requests/suggestions
Projects
None yet
Development

No branches or pull requests

3 participants