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
ES modules exports #2718
Comments
Feel it is not there yet |
I was able to add module exports { _ } to the end of my underscore.js file, to at least resolve the error message for importing as import _ from 'underscore.js' |
would be awesome 👍 |
Is there any good way we can add module exports to the main file, while maintaining backwards compatibility with non-module-supporting versions of JavaScript? |
However Babel does it?
…On Mon, Apr 23, 2018, 1:02 PM Jeremy Ashkenas ***@***.***> wrote:
Is there any good way we can add module exports to the main file, while
maintaining backwards compatibility with non-module-supporting versions of
JavaScript?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2718 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA9fvx9tIUVYAxL0PqcGIoDwhLe25ulOks5trjNlgaJpZM4RPowg>
.
|
maybe |
@jashkenas Thanks for your response. I don't think that it is possible to add the import statements on top of the main file and maintaining backwards compatibility without any transpilation task. The easiest solution, for me, would be to have a build task to translate import statements to UMD using babel and publish two versions of underscore: the first one with |
@jashkenas what do you think of @mjeanroy's suggestion? i would be happy to help... |
Sure! I'd be happy to merge a PR that swaps to named exports for all of the Underscore functions, and also uses Rollup to publish a UMD version of the file. |
@jashkenas very cool! do you want to keep the src in one single file or can functions be placed in individual files? |
One single file, please. If we can keep the diff as small and the result as clean as possible, that would help greatly. Ideally, just adding named exports to the functions where they are — with Underscore itself as the default export. |
@jgonggrijp unfortunately i have found no time to focus on this, so you are more than welcome to give it a go. if i find time in the near future to help out i will ping you and see how it is going. good luck, have fun! |
Duplicate of # |
ES modules exports (implements #2718)
Closed in #2826. |
Hi,
Is there a plan to migrate to ES Modules in the future or do you consider it worthless? It would be great to be able to import individual methods using ES imports, allowing tree-shaking and many other build optimization.
I'm sorry if this question has already been asked, but I searched in issue and could not find anything about it. Thanks for all the work behind underscore!
The text was updated successfully, but these errors were encountered: