You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding of allowSyntheticDefaultImports is that it assumes you have an extra build step that converts imports of the form import React from "react"; to import * 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.
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:
esModuleInterop: true
cause runtime error microsoft/TypeScript#41898 (comment)I'm not fully confident about this - would be keen for others to weigh in whether this assessment is accurate.
The text was updated successfully, but these errors were encountered: