I am trying to make dynamic import work in my angular 5 application. As per this github issue, the comment says that using module: esnext
should make it work. This is my config
"compilerOptions": {
"outDir": "./dist/out-tsc",
"noEmitOnError": true,
"target": "es2016",
"module": "esnext",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"sourceMap": true,
"moduleResolution": "node",
"declaration": false,
"lib": [
"es2016",
"dom"
]
}
Note: Not having es2016
in lib gives me errors because I am using .find()
and .includes
on Array's in my code.
I get this error when compiling
error TS1323: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
Not sure why it still says targeting ECMA2015 modules when I have module: esnext
.
I figured this out. Turns out that it was a silly mistake and I was editing tsconfig.json
in the root folder and there was another tsconfig.app.json
in src
folder that was overriding my settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With