After updating my app to angular 8 my routes did not change to new syntax loadChildren: () => import('./listing/listing.module').then(m => m.ListingModule)
so i did this manually but i am getting Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.
error.
After reading some answers i found to change "module": "esnext"
in tsconfig.json file. But even after this change my error is still there.
Below is my code:
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
}
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
Can please anyone tell what is wrong in the code?