[Vuejs]-Why does Jest throw an error on dynamic import() when calculating coverage for a Vue.js app?

0👍

The issue stemmed from a Babel configuration that did not support dynamic imports.

Resolved by:

  1. Installing @babel/plugin-syntax-dynamic-import

    npm i @babel/plugin-syntax-dynamic-import

  2. Adding it to .babelrc like so:

    {
    ...
    "plugins": [
    "@babel/plugin-syntax-dynamic-import",
    ],
    ...
    }

Leave a comment