ardatan / meteor-webpack

https://medium.com/@ardatan/meteor-with-webpack-in-2018-faster-compilation-better-source-handling-benefit-from-bc5ccc5735ef
MIT License
123 stars 29 forks source link

dynamicImport not work in vue router #50

Closed moslemir closed 5 years ago

moslemir commented 5 years ago

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

tafelito commented 5 years ago

@moslemir why did you close this issue? Did you find a solution?