我正在尝试在我的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。
| 归档时间: |
|
| 查看次数: |
3590 次 |
| 最近记录: |