Open JamieDanielson opened 1 month ago
Hi @JamieDanielson
That's a pretty detailed list. Thanks! :) Is it a proposal or already has a consensus with other maintainers?
- Change the package type to
module
inpackage.json
We don't need this step do we? If "exports" in package.json has the necessary "import" entries, then leaving empty or explicitly "type": "commonjs"
should be fine.
Is your feature request related to a problem? Please describe.
Our packages currently publish directories of ESM builds, but they do not follow ESM spec and therefore cause problems for some end users trying to use them. For example, see issue #3989 .
Required (for each package) to fully support ESM
./fileName.js
(may require adjustments to imports/exports that import directories)module
inpackage.json
package.json
(*, import, require
)tsconfig.esm.json
if it doesn't already existtype:module
andtype:commonjs
in apackage.json
.eslintrc.js
to.eslintrc.cjs
(or change to ESM syntax instead of usingmodule.exports
).tsconfig
s to parse.cjs
extensionsts-node/esm
loader (also requires install ofts-node
)Maybe Required, otherwise Recommended
nodenext
intsconfig.esm.json
, which integrates with node's native ESM support and gives warnings for missing.js
suffixes.tsconfig.esm.json
ts-mocha
against the ts source code)... idea from this blogThis (closed) PR can be used as a reference.
I would argue that we need a testing strategy in place to verify these changes, BEFORE we make any changes, as our current ESM tests cover a lot of ground but not the problems solved with this change. There are a few issues floating around I believe, but for now I will link #4008 to build out smoke / integration tests.
Related Issues that may be resolved with these changes:
3989
4106
4392
4396
4642
4794
4842