无法在Angular 5的tsconfig中使动态模块导入与模块esnext一起使用

Tah*_*her 7 angular angular5

我正在尝试在我的angular 5应用程序中进行动态导入。根据这个github问题,评论说使用module: esnext应该可以使其工作。这是我的配置

"compilerOptions": {
  "outDir": "./dist/out-tsc",
  "noEmitOnError": true,
  "target": "es2016",
  "module": "esnext",
  "experimentalDecorators": true,
  "emitDecoratorMetadata": true,
  "sourceMap": true,
  "moduleResolution": "node",
  "declaration": false,
  "lib": [
    "es2016",
    "dom"
  ]
}
Run Code Online (Sandbox Code Playgroud)

注:由于没有es2016在lib中,因为我使用的给我的错误.find().includes对磁盘阵列的在我的代码。

编译时出现此错误

error TS1323: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
Run Code Online (Sandbox Code Playgroud)

不知道为什么我仍然有针对ECMA2015模块的原因module: esnext

Tah*_*her 8

我想通了。原来,这是一个愚蠢的错误,我是编辑tsconfig.json在根文件夹,还有一个tsconfig.app.jsonsrc这是压倒一切的我的设置文件夹。