默认导入在 Babel 和 Typescript 之间的工作方式不同

Default Imports work differently between Babel and Typescript

这对 Babel/Webpack

来说完全没问题

import React from 'react';

但在 Typescript 中需要:

import * as React from 'react';

这是什么原因?

allowSyntheticDefaultImports 添加到您的 tsconfig.json 以允许从没有默认导出的模块中进行默认导入。