allowSyntheticDefaultImports and the new tsconfig flag esModuleInterop. That description is unclear since allowSyntheticDefaultImports is no longer supported in version 23.// These lines have been removed
if (tsCompilerOptions.allowSyntheticDefaultImports) {
plugins.push('transform-es2015-modules-commonjs');
}
allowSyntheticDefaultImports is not longer supported and that the new flag (esModuleInterop) should be used instead.I'm using esModuleInterop: true, and import * as React from 'react'; is the only thing that works. what is the right way to allow import React from 'react' when using this module?
Dealing with the same issue as @kelly-tock right now. I switched my tsconfig.json file up a bit and replaced allowSyntheticDefaultImports: true with esModuleInterop: true. Per the intellisense, this option will, "Emit '__importStar' and '__importDefault' helpers for runtime babel ecosystem compatibility and enable '--allowSyntheticDefaultImports' for typesystem compatibility. Requires TypeScript version 2.7 or later."
All is well and I can get rid of the * now 馃槃
Yup, moving to using esModuleInterop: true is the way to go, but yeah, doc should be fixed related to this
x-ref: #601
fixed in 23.10.0
Most helpful comment
Dealing with the same issue as @kelly-tock right now. I switched my
tsconfig.jsonfile up a bit and replacedallowSyntheticDefaultImports: truewithesModuleInterop: true. Per the intellisense, this option will, "Emit '__importStar' and '__importDefault' helpers for runtime babel ecosystem compatibility and enable '--allowSyntheticDefaultImports' for typesystem compatibility. Requires TypeScript version 2.7 or later."All is well and I can get rid of the
*now 馃槃