-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
fix: use require/import export map in package.json #697
Conversation
Codecov Report
@@ Coverage Diff @@
## main #697 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 1923 1923
Lines 176903 176887 -16
Branches 900 897 -3
=======================================
- Hits 175742 175732 -10
+ Misses 1105 1099 -6
Partials 56 56
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work right now 🤔
I get
file:///home/shinigami/OpenSource/faker.js-tests/esm/index.js:2
import { faker } from "@faker-js/faker";
^^^^^
SyntaxError: Named export 'faker' not found. The requested module '@faker-js/faker' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@faker-js/faker';
const { faker } = pkg;
Please checkout the https://github.com/faker-js/playground (and comment out the testings for #642)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally with the playground, it's working 👍
Please unlock your repo / this PR so maintainers can make changes / rebase the main branch into it. |
Closes #696 - please see there for more details
This is to make the export map compliant with NodeJS documentation and recommendations: https://nodejs.org/api/packages.html#conditional-exports
I believe the description and example there is pretty clear. It also mentions that using
node
as a mapping is usually wrong: