-
Notifications
You must be signed in to change notification settings - Fork 130
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 exports field to package.json #659
Changes from 4 commits
7e52522
a104ab2
4f71fba
644f9b8
8eb7233
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,6 +8,20 @@ | |||||||||||||
"main": "dist/a11y-dialog.js", | ||||||||||||||
"module": "dist/a11y-dialog.esm.js", | ||||||||||||||
"types": "dist/a11y-dialog.d.ts", | ||||||||||||||
"exports": { | ||||||||||||||
"import": "./dist/a11y-dialog.esm.js", | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh this is actually incorrect. The default exports needs to be under
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I mentioned in one of my messages, it fails if we use both
|
||||||||||||||
"require": "./dist/a11y-dialog.cjs", | ||||||||||||||
"types": "./dist/a11y-dialog.d.ts", | ||||||||||||||
"dist/*.esm.js": "./dist/*.esm.js", | ||||||||||||||
"dist/*.cjs": "./dist/*.cjs", | ||||||||||||||
"dist/*.js": "./dist/*.cjs", | ||||||||||||||
"dist/*": { | ||||||||||||||
"import": "./dist/*.esm.js", | ||||||||||||||
"require": "./dist/*.cjs", | ||||||||||||||
"types": "./dist/*.d.ts" | ||||||||||||||
}, | ||||||||||||||
"package.json": "./package.json" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. general best practice to allow importing your package.json |
||||||||||||||
}, | ||||||||||||||
"keywords": [ | ||||||||||||||
"modal", | ||||||||||||||
"dialog", | ||||||||||||||
|
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.
Is the reason we have to update these local paths because they go strictly through the file system and not at all through the package.json file (therefore ignoring the exports field)?
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.
🤔 I’m actually not sure about that one. Whatever gets tests to pass works 🤷🏻 (it’s been a while since I’ve used Cypress, but if it works, it works)
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.
In general, though,
.cjs
files should never be in<script>
tags, because they won’t be supported in browsers. My guess is that Cypress just doesn’t support ESM, or something.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.
Actually this has nothing to do with Cypress per se, it’s just a fixture, so I think I could be using the ESM version here. I’ll try.