2

I just updated an Angular 7 app to the latest version (8.0.2) following the steps of this guide:

https://update.angular.io/#7.0:8.0

As the last step indicates, I've replaced the way I load lazy modules using the new syntax:

FROM:

loadChildren: "./modules/fwc-policy/fwc-policy.module#FwcPolicyModule"

TO:

loadChildren: () => import('./modules/fwc-policy/fwc-policy.module').then(m => m.FwcPolicyModule)

But now, when I try to compile the application I get this error:

ERROR in src/app/modules/fwc-dashboard/fwc-dashboard.routes.ts(42,31): error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext'.

After googling a bit, I added the option "module": "esNext" to the tsconfig.json file, but the error remains. Do I need to change anything else to make it work?

Thanks in advance,

4
  • Actually, I did upgrade for my app from ng 7 to ng 8 and got the issue, the change of tsconfig.json that you mentioned is just enough, are you sure that config is not overridden and did take the change? have you restarted the app and make sure it is killed first? Commented Jun 26, 2019 at 10:35
  • Hi, to make sure, I closed the IDE and ran npm start from the command line and I got the same error... I changed the target option from es6 to esNext to see what happens and I got another error: WARNING: Zone.js does not support native async/await in ES2017.. Commented Jun 26, 2019 at 10:44
  • what your target inside tsconfig, try "target": "es2015" Commented Jun 26, 2019 at 10:49
  • 1
    I'm already explain here Commented Jun 26, 2019 at 10:55

1 Answer 1

2

The problem was that the module option was being overriden in file tsconfig.app.json to es2015. After changing it to esNext, it compiles fine now.

Cheers!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.