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

Add conditional exports data to the package #439

Merged
merged 1 commit into from
Aug 20, 2020
Merged

Add conditional exports data to the package #439

merged 1 commit into from
Aug 20, 2020

Conversation

Avaq
Copy link
Member

@Avaq Avaq commented Aug 11, 2020

This allows Node 14 users to import the modular code straight from "fluture", as opposed to having to deep import from "fluture/index.js".

@Avaq Avaq requested a review from dicearr August 11, 2020 13:32
@Avaq Avaq self-assigned this Aug 11, 2020
@codecov

This comment has been minimized.

@Avaq
Copy link
Member Author

Avaq commented Aug 11, 2020

This might need to be considered a breaking change. Prior to it, if a Node 14 user would do:

import Future from 'fluture'

Future.resolve (42)

That would work. Because 'fluture' would resolve to the CommonJS module, which contains all functions.

Now, this will throw TypeError: Future.resolve is not a function, because instead of loading the commonjs export, we now load the default modular export from index.js, which is just the Future constructor without any additional properties attached.

@Avaq Avaq added the breaking label Aug 11, 2020
This allows Node users to import the modular code straight from
"fluture", as opposed to having to deep import from "fluture/index.js".
@Avaq Avaq merged commit 4efcf6e into master Aug 20, 2020
@Avaq Avaq deleted the avaq/exports branch August 20, 2020 09:56
Avaq added a commit that referenced this pull request Aug 20, 2020
Breaking changes

- #439 If you were using `import Future from 'fluture'` on Node 14,
  then updating to this version will likely break your code. See
  this comment[1].

New Features

- #439 Doing `import 'fluture'` on Node 14 now loads the ESM module
  instead of the CJS module. This means it's no longer necessary to
  deep-import from `fluture/index.js` to get access to the modular version.

[1]: #439 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants