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

ES6 import #36

Closed
nlemoine opened this issue Oct 17, 2017 · 5 comments
Closed

ES6 import #36

nlemoine opened this issue Oct 17, 2017 · 5 comments

Comments

@nlemoine
Copy link
Contributor

In package.json

I think main should provide the non ES6 version of micromodal (dist/micromodal.min.js). I have some errors bundling it with browserify.

@ghosh
Copy link
Owner

ghosh commented Oct 18, 2017

@nlemoine Hey, I'm not sure if that would be possible as we have to maintain compatibility with ES6 as well.

You can use a babel transform with your Browserify. This should help you out - https://github.com/babel/babelify

Closing this for now, as ES6 imports already work. Feel free to let know if you face difficulties.

@ghosh ghosh closed this as completed Oct 18, 2017
@nlemoine
Copy link
Contributor Author

nlemoine commented Oct 21, 2017

Thanks for your feedback.

I'm already using babelify (my project code is ES6) but I'm having the same issue described here: babel/babelify#247
Maybe a babelify issue but I'm wondering how this can work as babelify presets aren't always the same across projects (using global: true results in a error saying Couldn't find preset "latest"). See last comment here: babel/babelify#215 (comment)

I think you can keep your original code in ES6 and provide multiple versions allowing developers to select the one depending on their environment. See: https://medium.com/@tarkus/how-to-build-and-publish-es6-modules-today-with-babel-and-rollup-4426d9c7ca71

Anyway, I fixed my issue for now using the dist version: import micromodal from 'micromodal/dist/micromodal'

@nlemoine
Copy link
Contributor Author

nlemoine commented Nov 29, 2017

@ghosh Please see: https://github.com/rollup/rollup-plugin-babel#external-dependencies

Would you consider reopening the issue?

@ghosh
Copy link
Owner

ghosh commented Nov 29, 2017

@nlemoine Thanks for the update and the relevant documentation.

Will look into it.

@nlemoine
Copy link
Contributor Author

nlemoine commented Dec 6, 2017

Thanks for considering the request! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants