Open domdomegg opened 9 months ago
https://github.com/microsoft/TypeScript/issues/54500#issuecomment-1574042512
TS core team will deprecate this flag later. This flag should set to true. So this issue can be closed I think 🤔️
Node does add default exports when consuming commonjs modules from es modules, see
https://nodejs.org/api/esm.html#commonjs-namespaces
To support this, when importing CommonJS from an ECMAScript module, a namespace wrapper for the CommonJS module is constructed, which always provides a default export key pointing to the CommonJS module.exports value.
My understanding of
allowSyntheticDefaultImports
is that it assumes you have an extra build step that converts imports of the formimport React from "react";
toimport * as React from "react";
(so you can write the former in place of the latter).However, by default Node does not do this natively. This can cause runtime errors when importing packages that haven't reexported everything as a default.
Also see:
I'm not fully confident about this - would be keen for others to weigh in whether this assessment is accurate.