I had this javascript error on a Bootstrap project. The file had this import statement:

import bootstrap from 'bootstrap'

Solution

This means you are probably trying to use ES6 javascript modules but haven't loaded in something like Babel. Some possible dependencies:

    "@babel/core": "^7.14.6",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/preset-env": "^7.14.7",

 Or maybe your webpack config has failed to generate a script from your vendor packages.