-
Notifications
You must be signed in to change notification settings - Fork 54
chore: Set packages' "main" to src/index locally to help type resolution #2253
base: master
Are you sure you want to change the base?
Conversation
// { "path": "../packages/react" }, | ||
// { "path": "../packages/react-component-event-listener" }, | ||
// { "path": "../packages/react-component-ref" }, | ||
// { "path": "../packages/styles" } |
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.
Comments there are cruft?
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.
Yup, I'll remove or uncomment this before checkin. I was curious if docs could build with project references but I'm not done testing yet.
+ "jsnext:main": "dist/es/index.js", | ||
+ "main": "dist/commonjs/index.js", | ||
+ "module": "dist/es/index.js", | ||
+ "types": "dist/es/index.d.ts", |
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.
These entries are cruft?
Overall looks good 👍 But please ensure that publishing will not be broken 🙏 |
From doing some experimenting I learned that with project references, if you make However, when I tried setting it up in this repo (with updated pre-publish logic to correct So now I'm back to trying to get everything working with the Also noticed that some tools don't seem to respect the |
These changes to resolution of internal packages will hopefully make removing aliases in #2243 (and various other work) go more smoothly and prevent the relative paths in inferred types issue.
Remove
tsconfig.json
paths
where possible, since that seems to cause the relative import issue. Instead, inpackage.json
set"main": "src/index.ts"
(and add a pre-publish task to switch it back). This is what @kenotron did in staging and it lets imports from the package root work without apaths
config.I also removed the the
types
,module
, andjsnext:main
settings from mostpackage.json
s, and updated the pre-publish task to add them back. Havingtypes
defined as a generated file (even withmain
pointing tosrc
) definitely seemed to prevent references from working properly, but I thought I'd also remove the other two for consistency?Other related changes:
packages/react
frominclude
s of other projects and use dependencies instead.docs
projectcomposite: true
settings