使用import a from 'a'试图导入一个CommonJS模块a会发生错误, 因为CommonJS无default导出
解决方法
- 使用
import a = require('a')语法 - 使用
import * as a from 'a'语法 - recommend: 使用
--esModuleInterop和--allowSyntheticDefaultImports
参考
Importing commonJS modules with es6 imports
Synthesize namespace records on CommonJS imports if necessary