dynamicImport not work in vue router
moslemir opened this issue · 1 comments
hello.
happy new year.
my bug:
router.js:1 Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: E:\Meteor\webpack\vuetify\imports\FrontEnd\router.js: Support for the experimental syntax 'dynamicImport' isn't currently enabled (1:21):
1 | const Index = () => import('./Main.vue');
| ^
2 | const Home = () => import('./Home.vue');
3 | const Content = () => import('./Content.vue');
4 | const Category = () => import('./Category.vue');
Add @babel/plugin-syntax-dynamic-import (https://git.io/vb4Sv) to the 'plugins' section of your Babel config to enable parsing.
my code:
const Index = () => import('./Main.vue');
const Home = () => import('./Home.vue');
const Content = () => import('./Content.vue');
const Category = () => import('./Category.vue');
const routes = [
{
path : '/',
component: Index,
children : [
{path: '', component: Home},
{path: 'home', component: Home},
{path: 'category-:id-:slug', component: Category},
{path: 'content-:id-:slug', component: Content},
{path: 'link', component: Category},
]
}
];
export default routes;
and i installed this and add plugin to .babelrc but not work :
https://babeljs.io/docs/en/next/babel-plugin-syntax-dynamic-import.html