-
Couldn't load subscription status.
- Fork 51
Closed
Description
(I realize this is really more of a TS question than it is an attw question, but given our recent discussions I figured it was worth filing here. Feel free to close this once you see it.)
I'm working on redoing the redux-thunk build setup atm, and also trying out https://github.com/egoist/tsup as a potential build tool.
My current package setup looks like this:
"main": "dist/cjs/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"default": "./dist/cjs/index.cjs"
},
"./extend-redux": {
"types": "./extend-redux.d.ts"
}
},Using the CLI wrapper I've set up for attw, I get this output:
I'm getting that FalseCJS warning, and I'm guessing it's because I have dist/index.mjs but dist/index.d.ts.
A few questions based on that:
- How critical is that mismatch in general? I know you've mentioned that "CJS and ESM output files can/should have different types". How much of a concern is that actually in practice? How much effort should I spend on trying to resolve this
attwwarning? tsupdoesn't currently have a way to generate.d.mtsoutput , per [feature] Generate esm-specific declaration files egoist/tsup#760 . Is it reasonable to copy overindex.d.ts->index.d.mtsin this case?redux-thunkonly has the one outputindex.d.tsfile. For RTK, we have many source files, and thus many.d.tsfiles:- Does only the
index.d.mtsfile need to exist with that extension (ie, there could beindex.d.mtsandotherFile.d.tsand that would work)? Or does every output declaration file need to have the.d.mtsextension for TS to load those properly in the ESM case?
- Does only the
- We've briefly discussed trying to bundle up TS declarations. What is the right tool for that currently?
Metadata
Metadata
Assignees
Labels
No labels
