TypeScript 4.7 introduced the node16 module resolution. This is more strict, and more correct than older module resolution options.
According to TypeScript, before this change it is possible to use require('ics'), but not import 'ics' from native ESM. This is because there is an explicit require export, that is accompanied by a .d.ts file, but there’s also a default export, which is untyped.
This change fixes it by removing index.js altogether. Its only purpose was to re-export everything from dist/index.js. This is now handled by pointing the main entrypoint and the default export in package.json to dist/index.js. The types export is necessary, because the file doesn’t exist in the same place as the dist files.
The module option was removed entirely. This is a faux ESM option that is supposed to point to a module using ESM syntax. It’s pointing to a CJS file instead, and it would now match the main field anyway.
TypeScript 4.7 introduced the
node16
module resolution. This is more strict, and more correct than older module resolution options.According to TypeScript, before this change it is possible to use
require('ics')
, but notimport 'ics'
from native ESM. This is because there is an explicitrequire
export, that is accompanied by a.d.ts
file, but there’s also a default export, which is untyped.This change fixes it by removing
index.js
altogether. Its only purpose was to re-export everything fromdist/index.js
. This is now handled by pointing the main entrypoint and the default export inpackage.json
todist/index.js
. Thetypes
export is necessary, because the file doesn’t exist in the same place as the dist files.The
module
option was removed entirely. This is a faux ESM option that is supposed to point to a module using ESM syntax. It’s pointing to a CJS file instead, and it would now match themain
field anyway.