Laravel mix can not compile import() function.
1 Answer
You got this import() Unexpected token because missing babel plugin allow parsing of import().
Please try to install one in either:
plugin-syntax-dynamic-import plugin
@babel/plugin-syntax-dynamic-import if you using @babel/core
Example command line:
npm i babel-plugin-syntax-dynamic-import
Create or edit your
.babelrcfile in your project root.{ "plugins": ["syntax-dynamic-import"] }
And try to run your project again.
Hope this work for you and for other members.

babel-plugin-syntax-dynamic-import.babelrcfile adding that plugin{ "plugins": ["syntax-dynamic-import"] }babelversion you using?@babel/core-> try@babel/plugin-syntax-dynamic-importplugin instead of.