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

Module or jsnext:main in package.json #90

Closed
danbucholtz opened this issue Oct 5, 2016 · 5 comments
Closed

Module or jsnext:main in package.json #90

danbucholtz opened this issue Oct 5, 2016 · 5 comments

Comments

@danbucholtz
Copy link

danbucholtz commented Oct 5, 2016

Since this is a Typescript app, can you distribute es5 code (es5 target) with es2015 modules in addition to the commonjs modules you distribute?

Set the moduleResolution to node as well to make everything work well in the tsconfig.json.

jsnext:main and module are the fields that point to the entrypoint for the es5 code with es2015 modules. Angular uses module and it seems most bundlers look for module, then jsnext:main, then main in that order.

Thanks,
Dan

@urish
Copy link
Owner

urish commented Oct 5, 2016

Hi Dan,

Can you please send a PR for that?

Thanks!

On Oct 5, 2016 6:10 AM, "Dan Bucholtz" [email protected] wrote:

Since this is a Typescript app, can you distribute es5 code (es5 target)
with es2015 modules in addition to the commonjs modules you distribute?

Set the nodeResolution to node as well to make everything work well.

jsnext:main and module are the fields that point to the entrypoint for
the es5 code with es2015 modules. Angular uses module and it seems most
bundlers look for module, then jsnext:main, then main in that order.

Thanks,
Dan


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#90, or mute the thread
https://github.com/notifications/unsubscribe-auth/AA2dnl2EiyQ4jcmfz6r6VhKbR1yEOot3ks5qwyMVgaJpZM4KOZuq
.

@danbucholtz
Copy link
Author

@urish,

Sorry, I cannot at this time. I submitted this issue to about 10-15 libs that we're seeing Ionic users use that don't follow this pattern. I don't have time, I am swamped with Ionic right now, but if you have any questions I can help as I have done this a few times now.

Thanks,
Dan

@urish
Copy link
Owner

urish commented Oct 5, 2016

@danbucholtz can you perhaps point me at another lib which has already implemented this?
I'm curious about the build process for producing both es5 and es5+esnext modules bundles.

@danbucholtz
Copy link
Author

Yes, definitely. Ionic 😄

This file covers the build portion of it.
https://github.com/driftyco/ionic/blob/master/scripts/gulp/tasks/build.ts

We create a temporary tsconfig.json for our build process depending on what step we're in.
https://github.com/driftyco/ionic/blob/master/scripts/gulp/util.ts#L35

Our package.json looks like this:
https://github.com/driftyco/ionic/blob/master/scripts/npm/package.json#L12

Let me know if you have any questions. It is kind of a lot to take in in someone else's repo to understand what's going on.

Thanks,
Dan

@urish
Copy link
Owner

urish commented Apr 11, 2018

Should be fixed once #191 lands

@urish urish closed this as completed Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants