-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 export specification #9697
Add export specification #9697
Changes from all commits
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 |
---|---|---|
|
@@ -16,6 +16,23 @@ | |
"main": "./dist/main.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/main.cjs" | ||
}, | ||
"./core": { | ||
"import": "./core/index.js", | ||
"require": "./core/core.cjs" | ||
}, | ||
"./link/error": { | ||
"import": "./link/error/index.js", | ||
"require": "./link/error/error.cjs" | ||
}, | ||
"./utilities/policies/pagination": { | ||
"import": "./utilities/policies/pagination.js" | ||
} | ||
}, | ||
Comment on lines
16
to
+35
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. To be compliant, I read the typescript handbook as the following (remove commented lines, add in types, and note the wrong published module path has not // -"main": "./main.cjs",
// -"module": "./index.js",
// -"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./main.cjs"
},
"./core": {
"types": "./core/index.d.ts",
"import": "./core/index.js",
"require": "./core/core.cjs"
},
"./link/core": {
"types": "./link/core/index.d.ts",
"import": "./link/core/index.js",
"require": "./link/core/error.cjs"
},
"./link/error": {
"types": "./link/error/index.d.ts",
"import": "./link/error/index.js",
"require": "./link/error/error.cjs"
},
"./utilities/policies/pagination": {
"types": "./utilities/policies/pagination.js",
"import": "./utilities/policies/pagination.js"
}
}, I will note however, that while I think the above exports are correct according to the handbook, that I still receive errors when attempting to use option 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. Thanks for the input. I believe though that the dist prefix is necessary, since that's where the files are in the distributed package. Feel free to add your other changes as github suggestions, then I will merge them. 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. @tobiasdiez I have confirmed that 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. It seems like you are right and there is indeed no dist folder. But the dist path is akso in "main" and "module", strange... 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. These paths must be rewritten during the build process. If you |
||
"sideEffects": false, | ||
"react-native": { | ||
"./dist/cache/inmemory/fixPolyfills.js": "./dist/cache/inmemory/fixPolyfills.native.js" | ||
|
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.
Without
"type": "module"
set,.js
is interpreted as CJS, not ESM. You need to use.mjs
to refer to ESM in a CJS package (which is the default).