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

Added module entry point in package.json #234

Merged
merged 1 commit into from
Jan 9, 2018
Merged

Conversation

Andarist
Copy link
Contributor

Webpack2+ and rollup will understand this out of the box when importing from the lib, no need to import from 'react-waypoint/es'

@trotzig
Copy link
Collaborator

trotzig commented Dec 22, 2017

Thanks @Andarist! We used to have module in the package.json file, but it was causing issues for people. This commit removed it: 0e791c0. Here's the issue that was filed after we added it: #221

I'm not going to close this PR just yet. If you or someone else can come up with a few workarounds for people who will run into trouble from this, I'm okay merging this and releasing it as v8 (so that people will have to make a manual upgrade + migration).

@Andarist
Copy link
Contributor Author

The problem described in the other issue was caused by using .mjs extension. Merging this PR as is wouldn't case any trouble.

Using .mjs as extension for module's entry wouldn't give any benefits, .mjs is node's thing and module is targeting web bundlers.

@jamesplease
Copy link
Collaborator

jamesplease commented Dec 23, 2017

I am a huge 👍 to this change as long as our build configuration outputs the right files.

This is what I do on personal libraries as well as libraries at work, and it works out really well. Furthermore, numerous other widely-used JS libraries do this, too, such as Redux. This configuration is the de facto way to support tree shaking with webpack without any side effects caused by unsupported extensions such as .mjs.

I discouraged us from using .mjs in the original PR where we introduced module, and, unsurprisingly to me that decision caused problems for our users. The problem has never been the module field (which is widely supported); it’s the extension (which has very little/nonexistent ecosystem support).

@Andarist makes a great point here, as well:

Using .mjs as extension for module's entry wouldn't give any benefits, .mjs is node's thing and module is targeting web bundlers.

tl;dr, I am strongly in favor of this change, and holding off on .mjs until it is more widely supported 👍

@lencioni
Copy link
Collaborator

lencioni commented Dec 25, 2017 via email

@trotzig
Copy link
Collaborator

trotzig commented Jan 9, 2018

Thanks for all the input folks!

@trotzig trotzig merged commit 1c14dc6 into civiccc:master Jan 9, 2018
@Andarist Andarist deleted the patch-1 branch January 9, 2018 19:07
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

Successfully merging this pull request may close these issues.

4 participants