这种写法import("view/flex/flexDice") 报错 Unexpected token
以下代码报这个错误,求教
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (9:11)
// ...
const flex = () => import("view/flex/flexDice"); // 第九行 Unexpected token
const animate = () => import("view/animate/animation");
const css3d = () => import("view/3d/css3d");
const d3 = () => import("view/d3/d3");
const vue2 = () => import("view/vue2/vue2");
const pwa = () => import("view/pwa/pwa");
const search = () => import("view/search/search");
let routes = [
{path:'/flex',component:flex},
{path:'/d3js',component:d3},
{path:'/anmiation',component:animate},
{path:'/3D',component:css3d},
{path:'/vue2',component:vue2},
{path:'/pwa',component:pwa},
{path:'/search',component:search},
// { path: '404', component:loadCmp('404/404') },
// { path: '*', redirect: { path:'/404' } }
];
export default routes;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(4)
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
const flex = r => require.ensure([], () => r(require(
'view/flex/flexDice')), 'flex');
我这样写没问题