Skip to content

Conversation

@jstasiak
Copy link
Contributor

This allows importing big.js in ESM packages without having to resolve
to the

import Big from 'big.js/big.mjs';

trick.

Fixes GH-170.

This allows importing big.js in ESM packages without having to resolve
to the

    import Big from 'big.js/big.mjs';

trick.

Fixes MikeMclGH-170.
@MikeMcl
Copy link
Owner

MikeMcl commented May 19, 2022

Yes, it's overdue I suppose, although as I state in the linked issue "any use of the exports field prevents loading from subpaths of the package so it would probably cause issues for some users".

Please use 2-space indentation and I'll accept it, thank you.

@jstasiak
Copy link
Contributor Author

Oops, I missed that – fixed

@jstasiak
Copy link
Contributor Author

Please let me know if I need to make any more changes here, happy to do it in order to get this merged.

@MikeMcl MikeMcl merged commit 1ef0018 into MikeMcl:master May 23, 2022
@MikeMcl
Copy link
Owner

MikeMcl commented May 23, 2022

Thanks for the reminder.

@jstasiak jstasiak deleted the esm-compat branch May 25, 2022 10:54
@jstasiak
Copy link
Contributor Author

Thank you merging this so fast @MikeMcl – is there a chance we have a release with this change? It'd unblock us and be very much appreciated

@MikeMcl
Copy link
Owner

MikeMcl commented May 26, 2022

On my other library bignumber.js I just accepted a PR which used:

  "exports": {
    ".": {
      "types": "./bignumber.d.ts",
      "require": "./bignumber.js",
      "import": "./bignumber.mjs",
      "browser": "./bignumber.js"
    },
    "./package.json": "./package.json"
  },

Any comments?

@jstasiak
Copy link
Contributor Author

Hmm, the snippet looks similar enough to this PR and I think they're equivalent but I'm relatively inexperienced with TS/JS packaging so take my opinion with a grain of salt. :)

@MikeMcl
Copy link
Owner

MikeMcl commented May 27, 2022

Okay, I'm just going to look into it a bit more and will publish within a week.

@MikeMcl
Copy link
Owner

MikeMcl commented Jun 4, 2022

Published v6.2.0 to npm.

@jstasiak
Copy link
Contributor Author

jstasiak commented Jun 6, 2022

Thank you very much, I can confirm it works perfectly for us.

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.

big.js is a CommonJS dependency

2 participants